diff --git a/HRM.UI/ClientApp/src/app/app.main.component.ts b/HRM.UI/ClientApp/src/app/app.main.component.ts index acc8828..6f86234 100644 --- a/HRM.UI/ClientApp/src/app/app.main.component.ts +++ b/HRM.UI/ClientApp/src/app/app.main.component.ts @@ -61,7 +61,7 @@ export class AppMainComponent { } if(user.UserType === "2"){ this.apiService.isSelService = true; - this.apiService.menuItems = this._auth.getUserMenu(); + this.apiService.menuItems = this.liftUnlabelledRootMenus(this._auth.getUserMenu()); } if(this.apiService.isSelService === true){ this.staticMenuDesktopInactive = true; @@ -74,6 +74,20 @@ export class AppMainComponent { } } } + // The server can send a top-level node with no label whose children are real top-level menus + // (e.g. "Dashboard"). Show those children in the topbar directly instead of under an empty parent. + liftUnlabelledRootMenus(menuItems: any[]): any[] { + const result: any[] = []; + (menuItems || []).forEach(item => { + const hasLabel = item.label && String(item.label).trim() !== ''; + if (!hasLabel && item.items && item.items.length > 0) { + result.push(...item.items); + } else if (hasLabel) { + result.push(item); + } + }); + return result; + } ProcessSelfServiceMenu(menuItems : any){ if(menuItems && menuItems.length > 0){ menuItems.forEach(item => { diff --git a/HRM.UI/ClientApp/src/app/app.menuitem.component.ts b/HRM.UI/ClientApp/src/app/app.menuitem.component.ts index 8fd5cf1..d9eb5ff 100644 --- a/HRM.UI/ClientApp/src/app/app.menuitem.component.ts +++ b/HRM.UI/ClientApp/src/app/app.menuitem.component.ts @@ -8,6 +8,7 @@ import {AppMainComponent} from './app.main.component'; import {RolePermission} from './_models/Authentication/role'; import { CommonModule } from '@angular/common'; import { RouterModule } from '@angular/router'; +import { JwtHelperService } from '@auth0/angular-jwt'; @Component({ /* tslint:disable:component-selector */ selector: '[app-menuitem]', @@ -119,9 +120,36 @@ export class AppMenuitemComponent implements OnInit, OnDestroy { key: string; + // SuperUser (UserType "0") only: every parent menu starts expanded and stays expanded when a + // child or another menu is clicked or the page changes; only clicking the parent itself toggles it. + private static superUserFlag: boolean | null = null; + private static superUserToken: string | null = null; + + private static isSuperUser(): boolean { + const token = localStorage.getItem('token'); + if (token !== AppMenuitemComponent.superUserToken) { + AppMenuitemComponent.superUserToken = token; + let userType: any = null; + try { + userType = token ? new JwtHelperService().decodeToken(token)?.UserType : null; + } catch (e) { + userType = null; + } + AppMenuitemComponent.superUserFlag = String(userType) === '0'; + } + return AppMenuitemComponent.superUserFlag === true; + } + + private get keepOpen(): boolean { + return !!(this.item && this.item.items) && AppMenuitemComponent.isSuperUser(); + } + constructor(public appMain: AppMainComponent, public router: Router, private cd: ChangeDetectorRef, private menuService: MenuService) { this.menuSourceSubscription = this.menuService.menuSource$.subscribe(key => { + if (this.keepOpen) { + return; + } // deactivate current active menu if (this.active && this.key !== key && key.indexOf(this.key) !== 0) { this.active = false; @@ -129,12 +157,17 @@ export class AppMenuitemComponent implements OnInit, OnDestroy { }); this.menuResetSubscription = this.menuService.resetSource$.subscribe(() => { - + if (this.keepOpen) { + return; + } this.active = false; }); this.router.events.pipe(filter(event => event instanceof NavigationEnd)) .subscribe(params => { + if (this.keepOpen) { + return; + } if (this.appMain.isHorizontal()) { this.active = false; @@ -166,7 +199,9 @@ export class AppMenuitemComponent implements OnInit, OnDestroy { } ngOnInit() { - if (!this.appMain.isHorizontal() && this.item.routerLink) { + if (this.keepOpen) { + this.active = true; + } else if (!this.appMain.isHorizontal() && this.item.routerLink) { this.updateActiveStateFromRoute(); } diff --git a/HRM.UI/ClientApp/src/app/app.topbar.component.html b/HRM.UI/ClientApp/src/app/app.topbar.component.html index 9f3afd0..e25b04d 100644 --- a/HRM.UI/ClientApp/src/app/app.topbar.component.html +++ b/HRM.UI/ClientApp/src/app/app.topbar.component.html @@ -146,7 +146,7 @@ @if (sub.items?.length) {
@if (sub.icon) { @@ -161,7 +161,7 @@ @if (activeSubMenu === sub.menuKey) {
+ [class.ss-submenu--up]="subMenuOpenUp"> @for (child of sub.items; track child) { .ss-submenu-link { - background: color-mix(in srgb, $topbar-accent-purple 10%, transparent); color: $topbar-navy; + background: var(--gh-sel); color: var(--gh-sb); } .ss-submenu-divider { height: 1px; margin: 4px 8px; @@ -176,6 +180,20 @@ top: -6px; width: 290px; z-index: 2001; + // Never taller than the screen: if it fits neither below nor above, it scrolls inside itself + max-height: calc(100vh - 24px); + overflow-y: auto; + scrollbar-width: thin; +} +// Not enough room below: grow upward from the parent item instead +.ss-submenu--nested.ss-submenu--up { + top: auto; + bottom: -6px; + animation: ssDropUp 0.14s ease; +} +@keyframes ssDropUp { + from { opacity: 0; transform: translateY(6px); } + to { opacity: 1; transform: translateY(0); } } .ss-topbar-right { display: flex; align-items: center; gap: 2px; flex-shrink: 0; @@ -209,7 +227,12 @@ .ss-dd { position: absolute; top: calc(100% + 8px); right: 0; left: auto; background: $color-white; border-radius: 14px; - box-shadow: 0 8px 32px color-mix(in srgb, $color-black 13%, transparent); + // Same panel look as the menu dropdown: palette border, dark top edge and a stronger shadow, + // so bookmark / pending approval / notification / user lists stand out from the cards behind. + border: 1px solid var(--gh-bo2); + border-top: 3px solid var(--gh-sb); + box-shadow: 0 14px 36px color-mix(in srgb, var(--gh-sb) 28%, transparent), + 0 3px 8px color-mix(in srgb, var(--gh-sb) 14%, transparent); list-style: none; margin: 0; padding: 0; z-index: 2000; animation: ssDropIn 0.14s ease; overflow: hidden; @@ -233,7 +256,7 @@ display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; border-bottom: 1px solid $topbar-border-dd-item; transition: background 0.12s; - &:hover { background: $topbar-bg-hover-dd-item; } + &:hover { background: var(--gh-sel); } &--new { background: $topbar-bg-dd-item-new; } &:last-child { border-bottom: none; } } @@ -266,7 +289,7 @@ display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: $topbar-text-slate; text-decoration: none; font-size: 13px; cursor: pointer; transition: background 0.12s; - &:hover { background: $topbar-bg-hover-dd-action; color: $topbar-text-dark; } + &:hover { background: var(--gh-sel); color: $topbar-text-dark; } i { font-size: 13px; color: $gray-500; } } .ss-hamburger { display: none; } @@ -443,10 +466,13 @@ .layout-topbar .topbar-menu > li.user-profile > ul { width: auto !important; // template has an inline width:250px min-width: 210px; - border: none; + // same panel as .ss-dd: palette border, dark top edge, stronger shadow + border: 1px solid var(--gh-bo2); + border-top: 3px solid var(--gh-sb); border-radius: 14px !important; // template has an inline border-radius:20px background: $color-white; - box-shadow: 0 8px 32px color-mix(in srgb, $color-black 13%, transparent); + box-shadow: 0 14px 36px color-mix(in srgb, var(--gh-sb) 28%, transparent), + 0 3px 8px color-mix(in srgb, var(--gh-sb) 14%, transparent); padding: 0; overflow: hidden; animation: ssDropIn 0.14s ease; @@ -478,14 +504,15 @@ } &:hover { - background: $topbar-bg-hover-dd-action; + background: var(--gh-sel); color: $topbar-text-dark; } } - // First row is the signed-in user's name: the ESS header row + // First row is the signed-in user's name: the ESS header row, centred > li:first-child > a { - justify-content: space-between; + justify-content: center; + font-weight: 600; padding: 13px 16px 9px; border-bottom: 1px solid $topbar-border-faint; color: $topbar-text-charcoal; @@ -501,5 +528,9 @@ color: $topbar-text-charcoal; } } + // the theme's generic row hover must not light up the name row + > li:first-child:hover { + background: transparent; + } } } diff --git a/HRM.UI/ClientApp/src/app/app.topbar.component.ts b/HRM.UI/ClientApp/src/app/app.topbar.component.ts index 3bac07b..6e80cb3 100644 --- a/HRM.UI/ClientApp/src/app/app.topbar.component.ts +++ b/HRM.UI/ClientApp/src/app/app.topbar.component.ts @@ -44,6 +44,7 @@ export class AppTopBarComponent implements OnInit, DoCheck, OnDestroy { menuItems: any[] = []; activeMenu: string | null = null; activeSubMenu: string | null = null; + subMenuOpenUp = false; mobileMenuOpen = false; mobOpenSection: string | null = null; mobOpenSubSection: string | null = null; @@ -549,9 +550,29 @@ export class AppTopBarComponent implements OnInit, DoCheck, OnDestroy { this.activeMenu = menuKey; this.activeSubMenu = null; } - openSubMenu(menuKey: string) { + openSubMenu(menuKey: string, event?: Event) { clearTimeout(this.closeTimer); + if (this.activeSubMenu === menuKey) { + return; + } this.activeSubMenu = menuKey; + this.subMenuOpenUp = false; + // Once the nested menu is rendered, open it upward if it would run past the bottom of the screen + // and there is more room above (it scrolls inside itself if it fits neither way). + const host = event?.currentTarget as HTMLElement | null; + if (host) { + setTimeout(() => { + const nested = host.querySelector('.ss-submenu--nested') as HTMLElement | null; + if (!nested || this.activeSubMenu !== menuKey) { + return; + } + const menuRect = nested.getBoundingClientRect(); + const hostRect = host.getBoundingClientRect(); + const spaceBelow = window.innerHeight - hostRect.top; + const spaceAbove = hostRect.bottom; + this.subMenuOpenUp = menuRect.bottom > window.innerHeight - 8 && spaceAbove > spaceBelow; + }); + } } closeSubMenu() { 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 df23da0..d60c54f 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 @@ -91,12 +91,14 @@ - + - @for (a of dataItem.actions; track a.action) { - - } +
+ @for (a of dataItem.actions; track a.action) { + + } +
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 a26996c..8cad316 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 @@ -136,6 +136,29 @@ .ul-row-action + .ul-row-action { margin-left: 6px; } +// Buttons always show their whole label: they never shrink, and if the column is too narrow +// the next button moves to a new line instead of the text being cut to "…". +.ul-row-actions { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px; + + // spacing comes from the gap here, so a wrapped button starts flush left + .ul-row-action + .ul-row-action { + margin-left: 0; + } +} +.ul-row-action { + flex-shrink: 0; + max-width: none; + white-space: nowrap; + + ::ng-deep .k-button-text { + overflow: visible; + text-overflow: clip; + } +} .ul-login { font-weight: 600; diff --git a/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.html b/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.html index 89d206a..733d253 100644 --- a/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.html +++ b/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.html @@ -20,16 +20,16 @@ {{employee?.employeeNo}}
- @if (!apiService.isSSO) { - } @if (switchUserId != undefined) { - } diff --git a/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.scss b/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.scss index cce7e1f..6c452c9 100644 --- a/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.scss +++ b/HRM.UI/ClientApp/src/app/ess/user-ssdashboard/user-ssdashboard.component.scss @@ -1398,4 +1398,15 @@ } .clickable { cursor: pointer !important; -} \ No newline at end of file +} + +// Edit Profile / Change Password / Switch: always a perfect circle (Kendo button padding no longer stretches them) +.profile-actions--desktop .action-btn { + box-sizing: border-box !important; + padding: 0 !important; + min-width: 30px !important; + min-height: 30px !important; + aspect-ratio: 1 / 1; + line-height: 1 !important; + border-radius: 50% !important; +} diff --git a/HRM.UI/ClientApp/src/styles/theme/gohr-theme.scss b/HRM.UI/ClientApp/src/styles/theme/gohr-theme.scss index 5dc2b82..fe20753 100644 --- a/HRM.UI/ClientApp/src/styles/theme/gohr-theme.scss +++ b/HRM.UI/ClientApp/src/styles/theme/gohr-theme.scss @@ -137,6 +137,22 @@ body .layout-wrapper .layout-topbar .topbar-menu > li > a .topbar-badge { body .layout-wrapper .layout-topbar .topbar-menu > li > ul { border-color: var(--gh-bo); } +// Desktop: same panel look as the self-service dropdowns (solid panel, palette border, dark top +// edge, stronger shadow) so user / bookmark / pending-job lists stand out from the page behind. +// Below 897px Babylon shows these lists inline inside the topbar, so they stay flat there. +@media screen and (min-width: 897px) { + body .layout-wrapper .layout-topbar .topbar-menu > li > ul { + background-color: var(--gh-tb); + border: 1px solid var(--gh-bo2); + border-top: 3px solid var(--gh-sb); + box-shadow: 0 14px 36px color-mix(in srgb, var(--gh-sb) 28%, transparent), + 0 3px 8px color-mix(in srgb, var(--gh-sb) 14%, transparent); + } + // Rows without their own link hover (pending jobs) get the same palette hover + body .layout-wrapper .layout-topbar .topbar-menu > li > ul > li:hover { + background-color: var(--gh-sel); + } +} body .layout-wrapper .layout-topbar .topbar-menu > li > ul a:hover { background-color: var(--gh-sel); }