Skip to content

feat: implement master data and employee management server actions al…#119

Merged
DRAGOR75 merged 1 commit into
masterfrom
dev-6
Jun 1, 2026
Merged

feat: implement master data and employee management server actions al…#119
DRAGOR75 merged 1 commit into
masterfrom
dev-6

Conversation

@DRAGOR75

@DRAGOR75 DRAGOR75 commented Jun 1, 2026

Copy link
Copy Markdown
Owner

…ong with corresponding admin components

Summary by CodeRabbit

Release Notes

  • New Features

    • Employee ID field is now editable in employee profiles and management interfaces.
  • Bug Fixes

    • Enhanced error messaging for duplicate Employee ID or Email conflicts.
    • Fixed navigation behavior to properly reflect updated Employee ID changes.

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
templtrainingportal Building Building Preview, Comment Jun 1, 2026 7:16am

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6594a4ca-b277-4d6c-8522-b42e4c5091d2

📥 Commits

Reviewing files that changed from the base of the PR and between 8d39616 and 653efe0.

📒 Files selected for processing (5)
  • app/actions/master-data.ts
  • app/actions/tni.ts
  • components/TNIProfile.tsx
  • components/admin/EmployeeManager.tsx
  • scratch_check_user.ts

📝 Walkthrough

Walkthrough

The PR enables editable employee IDs throughout the application: backend actions now accept an optional newId field and conditionally update the database record; error handling detects Prisma unique-constraint violations; TNI profile form captures and submits the new ID and navigates appropriately post-save; and the admin employee manager form permits ID modification during editing.

Changes

Enable Editable Employee ID

Layer / File(s) Summary
Backend schema and update operations
app/actions/tni.ts, app/actions/master-data.ts
updateEmployeeProfile schema and updateEmployee now accept optional newId and conditionally overwrite the employee id in Prisma when newId is provided and differs from the current identifier.
Duplicate ID error handling
app/actions/master-data.ts, app/actions/tni.ts
Both action handlers catch Prisma P2002 unique-constraint errors and return "Employee ID or Email already exists" instead of generic failure messages.
TNI Profile form state and submission
components/TNIProfile.tsx
Form state gains an editable id field initialized from the employee record; the save call passes newId sourced from form state to the backend.
TNI Profile UI and post-save navigation
components/TNIProfile.tsx
Employee ID field switched from read-only display to editable input; after successful save, the component navigates to an updated route if the ID changed, or refreshes otherwise.
Admin Employee Manager editable ID
components/admin/EmployeeManager.tsx
Emp ID input field is no longer disabled during edit mode, permitting administrators to change the employee identifier.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 An ID change, so smooth and sleek,
Forms now editable, no more unique mystique,
Navigate with care when IDs shift,
Dupli­cate guards catch every drift!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-6

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@DRAGOR75 DRAGOR75 merged commit 8852f0b into master Jun 1, 2026
1 of 4 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant