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

View File

@ -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(selectedUserID.id != null){
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 {

View File

@ -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);