Data Permission bug fix

This commit is contained in:
mashfiq 2024-12-12 15:44:31 +06:00
parent 6063bf6cf9
commit 710f5ba9c4
3 changed files with 45 additions and 30 deletions

View File

@ -26,11 +26,12 @@
<kendo-dropdownlist <kendo-dropdownlist
style="width:100%" style="width:100%"
[data]="users" [data]="users"
[defaultItem]="{ userName: 'Select User', userID: null }" [defaultItem]="{ userName: 'Select User', id: null }"
[textField]="'userName'" [textField]="'userName'"
[valueField]="'userID'" [valueField]="'id'"
[(ngModel)]="selectedUser" [(ngModel)]="selectedUser"
(valueChange)="onUserChange($event)" (valueChange)="onUserChange($event)"
[disabled]="!(_selectedPayroll != null && _selectedRoleType != null) "
> >
</kendo-dropdownlist> </kendo-dropdownlist>
</div> </div>
@ -48,6 +49,7 @@
[valueField]="'id'" [valueField]="'id'"
[valuePrimitive]="true" [valuePrimitive]="true"
(valueChange)="onPayrollChange($event)" (valueChange)="onPayrollChange($event)"
[disabled]="!_selectedRoleType"
> >
</kendo-dropdownlist> </kendo-dropdownlist>
</div> </div>
@ -59,10 +61,11 @@
<kendo-dropdownlist class="form-control form-control-sm input-sm" <kendo-dropdownlist class="form-control form-control-sm input-sm"
style="width:100%" style="width:100%"
[data]="permissionTypes" [data]="permissionTypes"
[defaultItem]="{ name: 'Select Permission Type', id: null }" [defaultItem]="{ name: 'Select Permission Type', value: null }"
[textField]="'name'" [textField]="'name'"
[valueField]="'id'" [valueField]="'value'"
(selectionChange)="EventPermissionType($event)" (selectionChange)="EventPermissionType($event)"
[disabled]="!_selectedPayroll"
> >
</kendo-dropdownlist> </kendo-dropdownlist>
</div> </div>

View File

@ -10,13 +10,13 @@ import { DataTransferService } from '../../data.transfer.service';
import { ApiService } from '../../app.api.service'; import { ApiService } from '../../app.api.service';
import { User } from '../../_models/Authentication/user'; import { User } from '../../_models/Authentication/user';
import { EnumAuthStatus, EnumExtension, TempEnumAuthStatus } from '../../_models/enums'; import { EnumAuthStatus, EnumExtension, TempEnumAuthStatus } from '../../_models/enums';
import {PayrollType} from '../../_models/Authentication/payrollType'; import { PayrollType } from '../../_models/Authentication/payrollType';
import {Employee} from '../../_models/Employee/employee'; import { Employee } from '../../_models/Employee/employee';
import {Grade} from '../../_models/Basic/grade'; import { Grade } from '../../_models/Basic/grade';
import {Department} from '../../_models/Basic/department'; import { Department } from '../../_models/Basic/department';
import {Designation} from '../../_models/HRBasic/designation'; import { Designation } from '../../_models/HRBasic/designation';
import {Location} from '../../_models/Basic/location'; import { Location } from '../../_models/Basic/location';
import {DynamicPicker, EnumDynamicpickerType} from '../../picker/dynamic-picker/Dynamic-Picker'; import { DynamicPicker, EnumDynamicpickerType } from '../../picker/dynamic-picker/Dynamic-Picker';
import { DataPermission } from 'src/app/_models/Basic/DataPermission'; import { DataPermission } from 'src/app/_models/Basic/DataPermission';
@ -52,19 +52,25 @@ export class DataPermssionComponent implements OnInit {
public isLocation: boolean = false; public isLocation: boolean = false;
onUserTypeChange(_selectedRoleType: any): void { onUserTypeChange(_selectedRoleType: any): void {
this.utilityHandlerService.ShowLoadingPanel = true; if (this._selectedRoleType.value != null) {
this.userService.GetUsers(this._selectedRoleType.value).subscribe( this.utilityHandlerService.ShowLoadingPanel = true;
(x) => { this.userService.GetUsers(this._selectedRoleType.value).subscribe(
this.users = x; (x) => {
this.utilityHandlerService.ShowLoadingPanel = false; this.users = x;
}, this.utilityHandlerService.ShowLoadingPanel = false;
(x) => { },
this.notificationService.showError(x); (x) => {
this.utilityHandlerService.ShowLoadingPanel = false; this.notificationService.showError(x);
}, this.utilityHandlerService.ShowLoadingPanel = false;
() => { },
this.utilityHandlerService.ShowLoadingPanel = false; () => {
}); this.utilityHandlerService.ShowLoadingPanel = false;
});
}
else {
this.users = [];
this.selectedUser = undefined;
}
} }
EventPermissionType(selectedPermissionType: any): void { EventPermissionType(selectedPermissionType: any): void {
@ -80,11 +86,13 @@ export class DataPermssionComponent implements OnInit {
} }
onUserChange(selectedUserID: any): void { onUserChange(selectedUserID: any): void {
this._selectedUser = selectedUserID; if(selectedUserID.id != null){
this._userID = this._selectedUser.id; this._selectedUser = selectedUserID;
this._userID = this._selectedUser.id;
if (this._userID != undefined && this._selectedPayroll != undefined)
this.loadGridView() if (this._userID != undefined && this._selectedPayroll != undefined)
this.loadGridView()
}
} }
onPayrollChange(selectedPayrollID: any): void { onPayrollChange(selectedPayrollID: any): void {

View File

@ -89,7 +89,11 @@ namespace HRM.UI.Controllers
param = new object[2]; param = new object[2];
param[i] = EnumStatus.Active; 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 = new Type[2];
paramtypes[i] = typeof(EnumStatus); paramtypes[i] = typeof(EnumStatus);