Skip to content

Dev 6#124

Merged
DRAGOR75 merged 6 commits into
masterfrom
dev-6
Jun 17, 2026
Merged

Dev 6#124
DRAGOR75 merged 6 commits into
masterfrom
dev-6

Conversation

@DRAGOR75

@DRAGOR75 DRAGOR75 commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Training calendar with employee self-nomination capabilities
    • Bulk upload functionality for training sessions and calendar events
    • Session data export to Excel
    • Untrained pending trainees report
    • Enhanced session management with filtering and controls
  • Bug Fixes

    • Improved training history creation during enrollment workflows
  • UI/UX Updates

    • Renamed "Department" to "Section" throughout application
    • Reorganized master data management dashboard
    • Enhanced session filtering, search, and navigation

@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
templtrainingportal Ready Ready Preview, Comment Jun 17, 2026 8:53am

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
10.8% Duplication on New Code (required ≤ 3%)
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@DRAGOR75 DRAGOR75 merged commit aece3eb into master Jun 17, 2026
2 of 4 checks passed
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 183d0c5d-ebd3-4cbd-9a39-29cce79b028b

📥 Commits

Reviewing files that changed from the base of the PR and between 42447ed and 435836f.

📒 Files selected for processing (78)
  • app/actions.ts
  • app/actions/calendar.ts
  • app/actions/delete-session.ts
  • app/actions/enrollment.ts
  • app/actions/manager-approval.ts
  • app/actions/reports.ts
  • app/actions/sessions.ts
  • app/actions/tni.ts
  • app/actions/update-batch.ts
  • app/actions/update-session.ts
  • app/actions/upload-calendar.ts
  • app/actions/upload-sessions.ts
  • app/admin/dashboard/DashboardClient.tsx
  • app/admin/dashboard/session/[sessionId]/page.tsx
  • app/admin/page.tsx
  • app/admin/planning/page.tsx
  • app/admin/reports/loading.tsx
  • app/admin/reports/untrained-pending/page.tsx
  • app/admin/sessions/SessionsDashboard.tsx
  • app/admin/sessions/[sessionId]/manage/management-client.tsx
  • app/admin/sessions/[sessionId]/manage/page.tsx
  • app/admin/sessions/[sessionId]/participants/participant-table-client.tsx
  • app/admin/tni-dashboard/bulk-upload/page.tsx
  • app/admin/tni-dashboard/calendar/page.tsx
  • app/admin/tni-dashboard/departments/page.tsx
  • app/admin/tni-dashboard/employees/page.tsx
  • app/admin/tni-dashboard/layout.tsx
  • app/admin/tni-dashboard/loading.tsx
  • app/admin/tni-dashboard/page.tsx
  • app/admin/tni-dashboard/settings/page.tsx
  • app/admin/tni-dashboard/subjects/page.tsx
  • app/admin/tni-dashboard/venues/page.tsx
  • app/admin/upload-calendar/page.tsx
  • app/admin/upload-programs/page.tsx
  • app/admin/upload-sessions/page.tsx
  • app/admin/upload-tni/page.tsx
  • app/api/cron/complete-sessions/route.ts
  • app/calendar/page.tsx
  • app/design-system/page.tsx
  • app/enroll/[batchId]/page.tsx
  • app/page.tsx
  • app/tni/[empId]/new/page.tsx
  • app/tni/[empId]/page.tsx
  • app/trainer/employee-tni/page.tsx
  • app/trainer/sessions/TrainerSessionsDashboard.tsx
  • app/trainer/sessions/[sessionId]/manage/management-client.tsx
  • app/trainer/sessions/[sessionId]/manage/page.tsx
  • app/user-hub/page.tsx
  • check-db.ts
  • components/Navbar.tsx
  • components/TNIDashboardClient.tsx
  • components/TNIProfile.tsx
  • components/admin/AdminDashboardTabs.tsx
  • components/admin/AdminHeader.tsx
  • components/admin/BulkUploadManager.tsx
  • components/admin/BulkUploadSessionsClient.tsx
  • components/admin/ConfirmBatchButton.tsx
  • components/admin/CreateSessionModal.tsx
  • components/admin/EditSessionModal.tsx
  • components/admin/EmployeeManager.tsx
  • components/admin/ExportSessionDataButton.tsx
  • components/admin/MasterDataRibbon.tsx
  • components/admin/ReportsDashboard.tsx
  • components/admin/SectionManager.tsx
  • components/admin/TrainingCalendarManager.tsx
  • components/admin/UntrainedPendingReport.tsx
  • components/admin/troubleshooting/AdminTabs.tsx
  • components/admin/troubleshooting/BulkUploader.tsx
  • components/admin/troubleshooting/FaultManager.tsx
  • components/planning/GanttCalendar.tsx
  • components/user/EmployeeCalendarClient.tsx
  • lib/cache-master-data.ts
  • prisma/schema.prisma
  • test-db.ts
  • test-papa-empty.js
  • test-papa.js
  • tsc_output.txt
  • vercel.json

📝 Walkthrough

Walkthrough

This PR introduces a full training calendar feature (admin CRUD lifecycle, employee self-nomination, CSV bulk scheduling), refactors the TNI Dashboard into per-section sub-routes with a ribbon navigation, expands session management (edit, delete, unlock, bulk upload), closes the training-history loop at enrollment and feedback time, adds an untrained-pending report with charts, and globally renames "Department" to "Section".

Changes

Training Calendar, TNI Dashboard Restructure, and Session Management

Layer / File(s) Summary
Schema: Employee profile fields and NominationBatch calendar fields
prisma/schema.prisma
Adds optional organizational fields to Employee (region, organization, highestQualification, department, departmentGroup) and calendar pre-scheduling fields to NominationBatch (proposedStartDate/EndDate, proposedTrainer/Location, publishToCalendar, capacity).
Calendar server actions: CRUD lifecycle and self-nomination
app/actions/calendar.ts, app/actions/delete-session.ts, app/actions/update-session.ts, app/actions/update-batch.ts
Exports getCalendarEvents, createCalendarEvent, confirmCalendarEvent, cancelCalendarEvent, selfNominateCalendar; adds deleteTrainingSession (nomination revert + relational teardown), updateSession (syncs batch proposed fields), and updateBatch.
Session actions: unlock, getBatchBasicDetails, capacity, and cron auto-complete
app/actions/sessions.ts, app/api/cron/complete-sessions/route.ts, vercel.json
Adds unlockSessionBatch (Scheduled→Forming with Completed guard), getBatchBasicDetails, dynamic capacity on createSession, and a cron GET route that bulk-completes past-endDate batches; cron registered at 0 1 * * *.
Training history loop: enrollment, self-enroll, and feedback
app/actions/enrollment.ts, app/actions.ts, app/actions/tni.ts, app/actions/manager-approval.ts, lib/cache-master-data.ts
selfEnroll marks nominations Completed and upserts trainingHistory for batch-linked enrollments; submitEmployeeFeedback switches to session.id-gated updateMany on existing history; getManagerApprovalData drops unstable_cache; getCachedAdminEmployees removes caching.
Bulk upload actions and pages
app/actions/upload-calendar.ts, app/actions/upload-sessions.ts, app/admin/upload-calendar/page.tsx, app/admin/upload-sessions/page.tsx, components/admin/BulkUploadSessionsClient.tsx
Adds processCalendarBatch (CalendarUploadRecord, date parsing, program/section/trainer resolution, dedup, Prisma transaction) and bulkUploadSessions (BulkSessionRow, per-row creates with partial-success); client components for CSV parse, preview, chunked upload, and progress.
TNI Dashboard: route split into sub-pages with ribbon navigation
app/admin/tni-dashboard/layout.tsx, app/admin/tni-dashboard/loading.tsx, app/admin/tni-dashboard/page.tsx, app/admin/tni-dashboard/..., components/admin/MasterDataRibbon.tsx, components/admin/AdminDashboardTabs.tsx
Replaces the monolithic TNI dashboard and AdminDashboardTabs with a MasterDataLayout + MasterDataRibbon and individual auth-gated server pages (departments, venues, subjects, employees, bulk-upload, calendar, settings). Index page redirects to /subjects.
GanttCalendar refactor and admin TrainingCalendarManager
components/planning/GanttCalendar.tsx, components/admin/TrainingCalendarManager.tsx, app/admin/tni-dashboard/calendar/page.tsx, app/admin/planning/page.tsx
GanttCalendar gains controlled view date, trainer selection, readOnly mode, wheel navigation, Unassigned trainer, per-trainer coloring, and click-to-open-tab bars. TrainingCalendarManager wraps it with month/trainer filter state and create/edit/delete row actions.
Session edit modal, multi-trainer create, and ConfirmBatchButton unlock
components/admin/EditSessionModal.tsx, components/admin/CreateSessionModal.tsx, components/admin/ConfirmBatchButton.tsx, app/admin/sessions/SessionsDashboard.tsx
New EditSessionModal handles session/batch modes dispatching updateSession/updateBatch with auto-computed assessment date. CreateSessionModal gains multi-trainer and capacity inputs. ConfirmBatchButton adds Unlock (Scheduled→Forming) and Completed badge paths.
Session management UI: filtering sidebar, expanded tables, and Excel export
app/admin/sessions/[sessionId]/manage/management-client.tsx, app/trainer/sessions/[sessionId]/manage/management-client.tsx, app/admin/sessions/[sessionId]/manage/page.tsx, app/admin/dashboard/session/[sessionId]/page.tsx, components/admin/ExportSessionDataButton.tsx
Management clients gain collapsible Controls sidebar, client-side waitlist filtering (search, location, designation), expanded enrolled-participant columns, and updated statistics counts. Session detail page gains ExportSessionDataButton for XLSX export with feedback averages.
Employee-facing calendar page and self-nomination client
app/calendar/page.tsx, components/user/EmployeeCalendarClient.tsx, app/enroll/[batchId]/page.tsx
Replaces static /calendar with an auth-gated server page rendering read-only GanttCalendar + EmployeeCalendarClient; EmployeeCalendarClient shows upcoming events with capacity status and a nomination modal that calls selfNominateCalendar. Enrollment page displays program name/dates from getBatchBasicDetails.
Reports: Untrained Pending action, component, and dashboard tab
app/actions/reports.ts, components/admin/UntrainedPendingReport.tsx, components/admin/ReportsDashboard.tsx, app/admin/reports/untrained-pending/page.tsx, app/admin/reports/loading.tsx
Adds getUntrainedPendingTrainees (raw SQL, memory-grouped), caches getTniReportData via unstable_cache; new UntrainedPendingReport component with searchable table, pie/bar charts, Excel export; ReportsDashboard adds third tab; new ADMIN-gated report page.
Navigation, terminology rename, and UI polish
components/Navbar.tsx, components/TNIDashboardClient.tsx, components/TNIProfile.tsx, components/admin/EmployeeManager.tsx, components/admin/BulkUploadManager.tsx, components/admin/SectionManager.tsx, app/admin/page.tsx, app/page.tsx, app/tni/..., various
Navbar gains Calendar links for TRAINER and ADMIN roles. "Department" renamed to "Section" across forms, tables, exports, and labels. TNIDashboardClient adds isTrainerView prop gating bypass-mail checkbox and new TNI Status column. EmployeeManager adds Region filter. BulkUploadManager adds calendar upload card. FaultManager drag-end fixed to await server call.

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant createCalendarEvent
  participant confirmCalendarEvent
  participant TrainingCalendarManager
  participant GanttCalendar
  participant Employee
  participant selfNominateCalendar

  Admin->>createCalendarEvent: programId, dates, capacity
  createCalendarEvent->>createCalendarEvent: create NominationBatch (Forming, publishToCalendar=true)
  createCalendarEvent-->>Admin: success

  Admin->>confirmCalendarEvent: batchId, scheduling details
  confirmCalendarEvent->>confirmCalendarEvent: create TrainingSession
  confirmCalendarEvent->>confirmCalendarEvent: update batch to Scheduled, publishToCalendar=false
  confirmCalendarEvent-->>Admin: success

  Employee->>GanttCalendar: view upcoming forming events (readOnly)
  Employee->>selfNominateCalendar: batchId, empId, justification
  selfNominateCalendar->>selfNominateCalendar: verify Forming, check duplicate, enforce capacity
  selfNominateCalendar->>selfNominateCalendar: create nomination record
  selfNominateCalendar-->>Employee: success / error

  note over Admin,TrainingCalendarManager: Cron at 01:00 UTC auto-completes Scheduled batches with past endDate
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • DRAGOR75/TEIPL-Training-Portal#121: Directly modifies submitEmployeeFeedback in app/actions.ts to write trainingHistory when a session has nominationBatchId—this PR supersedes that logic by switching to a session.id-gated updateMany.
  • DRAGOR75/TEIPL-Training-Portal#101: Both PRs modify getTniReportData in app/actions/reports.ts—this PR adds unstable_cache wrapping and a take: 15 cap on top programs.
  • DRAGOR75/TEIPL-Training-Portal#70: Introduced the Excel export in participant-table-client.tsx with "Section / Department" headers that this PR renames to "Section".

Poem

🐇 Hippity-hop, the calendar's alive,
Sections replaced departments—oh, what a jive!
Self-nominate, confirm, and unlock the batch,
The training loop closes—history's a match!
A ribbon of tabs keeps each dashboard tidy,
Cron runs at one AM, prompt and sprightly. 🗓️

✨ 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

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