diff --git a/CLAUDE.md b/CLAUDE.md index 0527700..77e9600 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,7 +61,9 @@ but several specifics are stale — prefer *this* file wherever the two disagree at `e:\HRMGIT\` alongside a sibling `IntegrationSuite` project (this checkout is a single self-contained repo and no `IntegrationSuite` exists), lists `npm run lint` as a working command (it is broken — see below), describes `Ease.Core` as "referenced as the `Ease.NetCore` NuGet package" -(the live one is the project in this repo), and counts "~250+" services (there are ~450 service classes, ~310 of them DI-registered). +(the live one is the project in this repo), and counts "~250+" services (there are ~450 service classes, ~310 of them DI-registered), describes the UI +kit as a PrimeNG/Kendo/Bootstrap mix (PrimeNG and Bootstrap are gone), and gives an absolute +`https://localhost:44374/api` dev base URL (it is the relative `/api`, see *Frontend*). ## Build & run @@ -106,7 +108,7 @@ npm test # ng test (Karma, entry src/test.ts) Both SPAs `ng serve` on 4200, so only one of the two can run at a time. - `npm run lint` is **broken**: `angular.json` still points at the `@angular-devkit/build-angular:tslint` - builder (with a `tslint.json`), which no longer exists in Angular 19. The `@angular-eslint/*` and `eslint` 9 devDependencies are + builder (with a `tslint.json`), which is not installed. `@angular-eslint/builder` and `eslint` 9 are installed, but there is no ESLint config file and no `@angular-eslint/builder:lint` target yet, so wiring ESLint up means adding both. - `npm test` works, but coverage is nominal — 18 `.spec.ts` files across the whole app. Single spec: @@ -117,8 +119,9 @@ Both SPAs `ng serve` on 4200, so only one of the two can run at a time. [`deploy.ps1`](deploy.ps1) does the whole thing: bumps `HRM.UI/ClientApp/src/version.json` (`YYYYMMDD-NN`, counter auto-increments per day), runs `ng build --configuration production ---base-href `, `dotnet publish` for `win-x64`, copies `dist/babylon` into the publish -folder's `wwwroot`, and writes an Angular `web.config` (SPA rewrites + no-cache for +--base-href `, `dotnet publish` for `win-x64` into `_`, copies +`dist/babylon` into its `wwwroot` and the whole `HRM.UI/RDLC` folder into its `RDLC` (publish alone copies +only the RDLC files the csproj lists), and writes an Angular `web.config` (SPA rewrites + no-cache for `index.html`/`version.json`). Edit `$baseHref`/`$outputFolder` at the top per client/environment before running. `VersionCheckService` (`ClientApp/src/app/version-check.service.ts`) polls `version.json` every 5 minutes and prompts a reload when the server version changes — keep the @@ -243,6 +246,29 @@ Every Excel interface in the app is served by the one [DataUploadController](HRM.UI/Controllers/CommonInterface/DataUploadController.cs) (`api/dataUpload`) — do not add a separate controller for a new uploader. +The older regular uploads (employee basic, life cycle, allowance, fund data, …; screen +`/common-interface/data-upload/:id`) all post to `regularExcelInterface`, and +`RegularDataUploadService.UploadData` switches on `EnumRegularDataUpload`. Their expected columns are declared +in `DataUploadColumnDefinationService` (file `BasicDataUploadProcessService.cs`), so a new column needs both: +declare it there and read it in the matching `Import…` method. + +### Large lists: virtual paging + +A list or report that can return many rows uses `` + `VirtualPagingDA.GetPage`: SQL Server +pages, searches, sorts and counts, and Export to Excel is streamed from the server. Follow the 4 steps in +[HRM.DA/DA/VirtualPaging/README.md](HRM.DA/DA/VirtualPaging/README.md) (worked examples: Discontinue Employee +Details, Employee Detail Information). Needs SQL Server 2016+. + +### PF percentage is per employee + +`SalaryCalculator.Process` calls `PFNEW()`, which takes the PF % from `Employee.PFPercentage`, not from +`SystemInformation` as the old `PF()` does (`PF()` is now used only by `ProcessLTA`). A Live PF member with no +percentage gets a PF of 0. The value is set through a life-cycle event (`EmpLifeCycle.PFPercentage`, copied to +`Employee` by `HREmployeeDA.UpdatePFPercentage`) or the employee / life-cycle uploads; the Logic key +`confirmation` / `autopfmembership` decides whether a confirmation also makes the employee a PF member. +**No `_DB_Changes.sql` adds these two columns**: without `EmpLifeCycle.PFPercentage` every life-cycle +insert/update fails, and without `Employee.PFPercentage` setting the percentage fails. + ### Employee Bulk Upload The whole information of many employees in one spreadsheet — one row per employee, carrying that @@ -438,16 +464,16 @@ calendar's Users dropdown once came back silently empty for exactly this reason. column: use the pattern in `CalendarItemDA.UserEmailExpression`, which checks `COL_LENGTH` once per process and builds `COALESCE(EmailAddress, Email)` from whichever columns exist. Server-side SQL errors that the UI swallows land in `HRM.UI/Log/Error.log` (`ExceptionLog`), the first place to look. -Two places don't follow that pattern yet. `UserDA.Insert` writes only `Email`, so creating a user fails on a +Two places don't follow that pattern yet. `UserDA.Insert` and `Update` write only `Email`, so saving a user fails on a database that lacks it (the pending `UsersEmailColumn_DB_Changes.sql` adds it; its header wrongly says Insert writes both columns). `UserService.MapObject` reads only `Email` (the `EmailAddress` line is commented out), so the user list's `email` is blank wherever addresses live in `EmailAddress`. -Gotcha in user approval: `UserDA.Approve` always sets `Status = Approved` (5), whatever the request was. So -"approving" an `Inactive_Not_Yet_Approve` (9) or `Inactive` (8) user **re-activates** them, and a deactivation -can never actually be approved. The user list labels that action "Re-activate" for this reason; the fix -belongs in the server. +Gotcha in user approval: `UserDA.Approve` writes whatever `UserStatus` the client posts; the server works +nothing out. `users-list.component.ts` sends `Inactive` when approving a pending deactivation (status 9) and +`Approved` otherwise, and the "maker cannot approve their own change" check for users is only in that +component too. (Its comment saying the server always sets Approved is out of date.) ### Authentication pages: maker-checker and audit log @@ -458,6 +484,24 @@ change is saved with an `EnumAuthStatus` (`HRM.BO/HRBasic/Enums.cs`) pending sta `Approve` / `Reject`, `RoleService` for roles and permissions). Follow that state set for any new Authentication page rather than inventing a status column. +**Super User IDs can be negative.** Test "has a user" / "was edited" as `!= 0`, never `> 0` (a role's maker is +`ModifiedBy` when it is not 0, else `CreatedBy`), in C# and in Angular alike. `AuthController.ValidateResetToken` +still checks `data.UserID <= 0`, so a reset link for a negative-ID Super User always reads as invalid. + +### Login, OTP and forgot password + +- **MFA** is on when `LDAPSettings.isMFA` is true (`MFATimer` = minutes); the code length and mail/SMS channel + are Logic keys under `mfa`. `login` then returns an `mfaSessionId`, and `verify-mfa` issues the token. The + challenge is held in **in-process memory**, so it does not survive a restart or a second server. +- `login`, `verify-mfa` and `resend-otp` are rate-limited per IP (`LoginPolicy` / `MfaPolicy` / + `ResendOtpPolicy` in `Startup`). The forgot-password endpoints are not. +- The OTP flow writes a trace to `C:\Log\OTP log .txt`; `C:\Log` must exist on the server. +- **Forgot password** mails a link to `#/reset-password?token=…`. Nothing is stored: the token + (`HRM.UI/Helpers/PasswordResetTokenHelper.cs`) is AES-GCM encrypted with a key derived from + `AppSettings.Secret`, expires after `ForgotPasswordSettings.LinkExpiryMinutes`, and carries a fingerprint of + the current password, which makes it single-use. The link's base address is `EmailSettings.WebAddress` + (`http://localhost:4200/` in Development), so set that per deployment. + The **System Audit Log** page (`SystemAuditHistoryService`, `HRM.DA/DA/Users/SystemAuditHistoryDA.cs`) writes nothing itself: it reads `Z_ROLE`, `Z_ROLEPERMISSION`, `Z_USERS`, `Z_USERROLE`, `Z_USERACCESSTYPE`, which **database triggers** (`trRole`, `trRolePermission`, `trUsers`, `truserrole`, `trUserAccessType`) fill. Only @@ -500,7 +544,9 @@ When behavior differs between clients, look for or add a Logic key rather than b **This checkout is not that repo.** It is `HRM-10` (`origin` = `103.197.204.162:3025/CelHRTeam/HRM-10`), a fresh import whose history starts at one squashed commit (`838b8d4` "first commit"). Since then it uses ordinary short-lived branches: `main` is the integration branch (PR target), with per-developer -branches (`dev_`, `dev__`, `shamim`) merged back into it. +branches (`dev_`, `dev__`, `shamim`) merged back into it. Client branches have started here too: +`Brac_Master` (with `Brac_Master_` developer branches) is ahead of `main`, so check which line a change +belongs to before choosing a PR target. None of the older history exists here: every commit hash quoted elsewhere in this file (`c8588ce67`, `91369150c`, `ac179c03e`, `73f466cd0`, `bfd085e0e`) is from the original `CelHRTeam/cel.hrm` repo, and `git show`/`git log` recovery commands only work in a clone of that repo, not here. @@ -538,7 +584,7 @@ What actually drives the DB connection: Other live sections: `AppSettings` (`Secret`, `DefaultDB`, `RDLCLocation`, `downloadFolder`, attendance import settings), `EmailSettings`, `EmployeeApiInfo`, `AdminPendingJob`, -`MobileAppSettings`, `FundInfo`, `OpenAI`, `LDAPSettings`, `Calendar` (bound to +`MobileAppSettings`, `FundInfo`, `OpenAI`, `LDAPSettings`, `ForgotPasswordSettings`, `Calendar` (bound to `HRM.BO/Configuration/CalendarSettings.cs`), plus many payroll/fund GL-head keys. `Startup.cs` has large commented-out blocks — verify against live code before assuming a feature is @@ -713,6 +759,7 @@ Four pieces decide where a page load actually lands, and they are easy to break `/ess/landing-page`, `SuperUser` stays. So anything that lands on `''` ends up on a dashboard. - `AppMainComponent`'s constructor calls `authService.logout()` when the load is **not** a reload (`performance.navigation.type`), which is why opening a deep link in a fresh tab signs the user out. + The exception is `#/reset-password`: it logs out but stays on the page. - `` sits in [app.main.component.html](HRM.UI/ClientApp/src/app/app.main.component.html) — `[hidden]`, **not `*ngIf`**. So `LoginComponent`'s constructor runs once at bootstrap on *every* route, not just on diff --git a/HRM.UI/ClientApp/src/app/app.routes.ts b/HRM.UI/ClientApp/src/app/app.routes.ts index e9a3be4..e25a48e 100644 --- a/HRM.UI/ClientApp/src/app/app.routes.ts +++ b/HRM.UI/ClientApp/src/app/app.routes.ts @@ -145,6 +145,11 @@ export const routes: Routes = [ loadChildren: () => import('./payroll-ot/payroll-ot.module').then(m => m.PayrollOtModule) }, + { + path: 'payroll-lfa', + canActivate: [AuthGuard], + loadChildren: () => import('./payroll-lfa/payroll-lfa.module').then(m => m.PayrollLfaModule) + }, { path: 'payroll-tax', canActivate: [AuthGuard], diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.html b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.html new file mode 100644 index 0000000..bc190a1 --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.html @@ -0,0 +1,8 @@ + +
+ + LFA Bank Advice + + + +
diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.scss b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.ts b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.ts new file mode 100644 index 0000000..d9af55c --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-bank-advice/lfa-bank-advice.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; +import { ApiService } from '../../app.api.service'; + +@Component({ + selector: 'app-lfa-bank-advice', + templateUrl: './lfa-bank-advice.component.html', + styleUrls: ['./lfa-bank-advice.component.scss'], + changeDetection: ChangeDetectionStrategy.Eager, + standalone: false, +}) +export class LfaBankAdviceComponent implements OnInit { + + constructor(public apiService: ApiService) { + this.apiService.selectedMenuName = 'LFA Bank Advice'; + } + + ngOnInit() { + } +} diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.html b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.html new file mode 100644 index 0000000..cd96c1d --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.html @@ -0,0 +1,8 @@ + +
+ + LFA Payment Approval + + + +
diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.scss b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.ts b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.ts new file mode 100644 index 0000000..e2626dd --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-approval/lfa-payment-approval.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; +import { ApiService } from '../../app.api.service'; + +@Component({ + selector: 'app-lfa-payment-approval', + templateUrl: './lfa-payment-approval.component.html', + styleUrls: ['./lfa-payment-approval.component.scss'], + changeDetection: ChangeDetectionStrategy.Eager, + standalone: false, +}) +export class LfaPaymentApprovalComponent implements OnInit { + + constructor(public apiService: ApiService) { + this.apiService.selectedMenuName = 'LFA Payment Approval'; + } + + ngOnInit() { + } +} diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.html b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.html new file mode 100644 index 0000000..b3ed55b --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.html @@ -0,0 +1,8 @@ + +
+ + LFA Payment Undo + + + +
diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.scss b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.ts b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.ts new file mode 100644 index 0000000..ea47e07 --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment-undo/lfa-payment-undo.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; +import { ApiService } from '../../app.api.service'; + +@Component({ + selector: 'app-lfa-payment-undo', + templateUrl: './lfa-payment-undo.component.html', + styleUrls: ['./lfa-payment-undo.component.scss'], + changeDetection: ChangeDetectionStrategy.Eager, + standalone: false, +}) +export class LfaPaymentUndoComponent implements OnInit { + + constructor(public apiService: ApiService) { + this.apiService.selectedMenuName = 'LFA Payment Undo'; + } + + ngOnInit() { + } +} diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.html b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.html new file mode 100644 index 0000000..dd849b6 --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.html @@ -0,0 +1,8 @@ + +
+ + LFA Payment + + + +
diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.scss b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.ts b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.ts new file mode 100644 index 0000000..013e9fb --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/lfa-payment/lfa-payment.component.ts @@ -0,0 +1,19 @@ +import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core'; +import { ApiService } from '../../app.api.service'; + +@Component({ + selector: 'app-lfa-payment', + templateUrl: './lfa-payment.component.html', + styleUrls: ['./lfa-payment.component.scss'], + changeDetection: ChangeDetectionStrategy.Eager, + standalone: false, +}) +export class LfaPaymentComponent implements OnInit { + + constructor(public apiService: ApiService) { + this.apiService.selectedMenuName = 'LFA Payment'; + } + + ngOnInit() { + } +} diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/payroll-lfa-routing.module.ts b/HRM.UI/ClientApp/src/app/payroll-lfa/payroll-lfa-routing.module.ts new file mode 100644 index 0000000..ce7875d --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/payroll-lfa-routing.module.ts @@ -0,0 +1,20 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { AuthGuard } from '../_guards/auth.guard'; +import { LfaPaymentComponent } from './lfa-payment/lfa-payment.component'; +import { LfaPaymentUndoComponent } from './lfa-payment-undo/lfa-payment-undo.component'; +import { LfaPaymentApprovalComponent } from './lfa-payment-approval/lfa-payment-approval.component'; +import { LfaBankAdviceComponent } from './lfa-bank-advice/lfa-bank-advice.component'; + +export const routes: Routes = [ + { path: 'lfa-payment', component: LfaPaymentComponent, canActivate: [AuthGuard] }, + { path: 'lfa-payment-undo', component: LfaPaymentUndoComponent, canActivate: [AuthGuard] }, + { path: 'lfa-payment-approval', component: LfaPaymentApprovalComponent, canActivate: [AuthGuard] }, + { path: 'lfa-bank-advice', component: LfaBankAdviceComponent, canActivate: [AuthGuard] } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class PayrollLfaRoutingModule { } diff --git a/HRM.UI/ClientApp/src/app/payroll-lfa/payroll-lfa.module.ts b/HRM.UI/ClientApp/src/app/payroll-lfa/payroll-lfa.module.ts new file mode 100644 index 0000000..005e5b2 --- /dev/null +++ b/HRM.UI/ClientApp/src/app/payroll-lfa/payroll-lfa.module.ts @@ -0,0 +1,26 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { CardModule } from '@progress/kendo-angular-layout'; + +import { PayrollLfaRoutingModule } from './payroll-lfa-routing.module'; +import { LoadingPanelModule } from '../hrm-loding panel/loading-panel.module'; +import { LfaPaymentComponent } from './lfa-payment/lfa-payment.component'; +import { LfaPaymentUndoComponent } from './lfa-payment-undo/lfa-payment-undo.component'; +import { LfaPaymentApprovalComponent } from './lfa-payment-approval/lfa-payment-approval.component'; +import { LfaBankAdviceComponent } from './lfa-bank-advice/lfa-bank-advice.component'; + +@NgModule({ + declarations: [ + LfaPaymentComponent, + LfaPaymentUndoComponent, + LfaPaymentApprovalComponent, + LfaBankAdviceComponent + ], + imports: [ + CommonModule, + PayrollLfaRoutingModule, + LoadingPanelModule, + CardModule + ] +}) +export class PayrollLfaModule { }