From 46ad335dbeb9eec843d5ec9629a705e2055281fe Mon Sep 17 00:00:00 2001 From: Mohaimen Hasan Date: Tue, 17 Nov 2026 10:58:33 +0600 Subject: [PATCH] User and ROle Permission --- .../role-permission-list.component.html | 17 +++--- .../role-permission-list.component.ts | 20 +++++++ .../users-list/users-list.component.html | 53 ++++++++----------- .../users-list/users-list.component.scss | 23 +++++++- 4 files changed, 75 insertions(+), 38 deletions(-) diff --git a/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.html b/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.html index 17bdbbc..379ec55 100644 --- a/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.html +++ b/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.html @@ -1,5 +1,5 @@ -
- - + + +
@@ -75,7 +77,10 @@ } @if (dataItem.roleStatus !=1 && dataItem.roleStatus !=5) { - + } diff --git a/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.ts b/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.ts index 939c618..4c74621 100644 --- a/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.ts +++ b/HRM.UI/ClientApp/src/app/authentication/role/role-permission-list/role-permission-list.component.ts @@ -73,9 +73,29 @@ export class RolePermissionListComponent implements OnInit { public ngOnInit(): void { this.selectedRole = new Role(); this.showModal = false; + this.useService.GetCurrentUser().subscribe( + (resp: any) => { + this.currentUserID = resp?.userID; + }, + ); this.load(); } + /** Logged-in user's ID: the maker of a pending role cannot approve it. */ + currentUserID: number; + + /** + * True when the logged-in user made the role's pending change: whoever last edited it, or its + * creator if it was never edited (same rule as the entry dialog and the server). Their Approve is disabled. + */ + isMakerOf(role: Role): boolean { + if (this.currentUserID == undefined || role == undefined) { + return false; + } + const makerID = (role.modifiedBy ?? 0) > 0 ? role.modifiedBy : role.createdBy; + return makerID == this.currentUserID; + } + load() { this.useService.getAllRoles() diff --git a/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.html b/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.html index 6cdd8ee..97bdb2a 100644 --- a/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.html +++ b/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.html @@ -30,13 +30,8 @@ - - +
- - Export - + + +
@@ -92,22 +84,19 @@ {{ dataItem.createdDate | date: 'dd MMM yyyy' }} } @if (dataItem.createdByName) { - ยท {{ dataItem.createdByName }} + {{ dataItem.createdByName }} } - + + - - + @for (a of dataItem.actions; track a.action) { + + } @@ -139,12 +128,14 @@ @if (showModal) { - - - Add/Edit User - - - +
+ + + Add/Edit User + + + +
} @if (showReason) { diff --git a/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.scss b/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.scss index 7d5b130..3ec4cf9 100644 --- a/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.scss +++ b/HRM.UI/ClientApp/src/app/authentication/users/users-list/users-list.component.scss @@ -103,9 +103,15 @@ // ---------- grid ---------- :host ::ng-deep .ul-grid { + // The global `.k-dropdownlist { width: 100% !important }` (styles/vendors/kendo/_calendar.scss) + // made the User type dropdown fill the whole toolbar row and pushed the rest onto the next line. + // Keep it compact so dropdown, search, chips and buttons stay on one line, like the Role page. + .ul-type.k-dropdownlist { + width: 170px !important; + } + // Uniform, compact rows .k-grid-table td { - height: 44px; padding-top: 4px; padding-bottom: 4px; vertical-align: middle; @@ -126,6 +132,11 @@ } } +// Row action buttons (last column), side by side like the Role page +.ul-row-action + .ul-row-action { + margin-left: 6px; +} + .ul-login { font-weight: 600; color: $gray-700; @@ -160,6 +171,12 @@ .ul-badge--warning { background: $userlist-warning-bg; color: $userlist-warning; } .ul-badge--neutral { background: $userlist-neutral-bg; color: $userlist-neutral; } .ul-badge--danger { background: $userlist-danger-bg; color: $danger; } +// "Created by" name next to the date in the Created column +.ul-badge--info { background: #E8EEFC; color: #2F4FB5; } + +.ul-created-by { + margin-left: 8px; +} .ul-empty { padding: 32px 16px; @@ -194,4 +211,8 @@ .ul-search { width: 100%; } + + :host ::ng-deep .ul-grid .ul-type.k-dropdownlist { + width: 100% !important; + } }