Skip to content

Placement Cell: sync placement-pbi-v1 with acad-main + placement module#249

Merged
vikrantwiz02 merged 14 commits into
FusionIIIT:placement-pbi-v1from
vikrantwiz02:placement-pbi-v1-prod-sync
Jun 21, 2026
Merged

Placement Cell: sync placement-pbi-v1 with acad-main + placement module#249
vikrantwiz02 merged 14 commits into
FusionIIIT:placement-pbi-v1from
vikrantwiz02:placement-pbi-v1-prod-sync

Conversation

@vikrantwiz02

Copy link
Copy Markdown
Member

Brings `placement-pbi-v1` up to date with production (`acad-main`) and adds the placement cell module on top.

This branch = `acad-main` (current production) + the placement work, so merging syncs the (49-commits-behind) `placement-pbi-v1` with production and ships the module in one go.

Placement module

  • Role-based tabs (student / alumni / officer / chairman) via the shared ModuleTabs navbar.
  • Schedule agenda + card views; interactive calendar (click-to-add events, edit/delete; students read-only) merged with drives and deadlines.
  • Student CPI (published-CPI per batch + Excel export), Off-Campus Placements (company autocomplete), Announcements.
  • Add-drive form: branches from the API, inline application-field creation, restriction awareness.
  • Native date/time inputs; lazy-loaded tabs + vendor code-splitting for fast load.
  • Module README + frontend README.

Pairs with backend PR FusionIIIT/Fusion#1923.

Integrate the placement frontend onto acad-main (production-ready):
- Add src/Modules/PlacementCell (pages, forms, tables, common, api) and
  src/routes/placementCellRoutes; register /placement-cell in App.jsx.
- Wire the sidebar "Placement Cell" entry to /placement-cell.
- Drop 24 unreachable duplicate files left from the PR's mid-refactor state.
- Add date-fns and react-big-calendar (required by the placement calendar).
- Placement code passes eslint --fix/lint; vite build green.

No auth/login/academic or other modules changed.
- Add Vitest config (separate from vite.config.js so the build is untouched)
  with jsdom + a setup file shimming matchMedia/ResizeObserver for Mantine.
- Add 'test'/'test:watch' npm scripts and testing devDependencies.
- authorization.test.js: role lists, 403 detection, error-message routing.
- helpers.test.js: auth token/header/config building, CSRF + jobId parsing.
- api.test.js: placementApi targets the /placement/api/* surface and sends
  the Token auth header / correct payloads (mocked axios) -- guards the
  frontend<->backend URL contract.
- AuthorizationError.test.jsx: renders under Mantine + Router.

Run with: npm test  (19 tests, all passing).
Replace the placement module's hand-rolled Tabs/caret nav (which wrapped to
multiple rows) with the shared components/moduleTabs ModuleTabs component, so
the tab bar matches Examination, Academic and Dashboard: a single scrollable
row with prev/next carets. Also dispatches setActiveTab_ so breadcrumbs track
the active tab.
Wire the new placement_cell backend features into the UI additively:

- AnnouncementsPanel: lists announcements for every role; TPO/chairman get
  create and delete controls.
- OffCampusPlacements: TPO/chairman manage off-campus offers by roll number
  in a Mantine table.

Adds the api.js methods (getAnnouncements/createAnnouncement/deleteAnnouncement,
getOffCampusPlacements/createOffCampusPlacement/deleteOffCampusPlacement),
registers the new tabs in the role tab arrays, and extends the api contract
tests.
Wire the published-CPI backend into the UI for TPO and chairman roles:

- StudentCpiTab: pick a batch with published results, view each student's
  published CPI and off-campus companies in a Mantine table, and export the
  rows to Excel.
- api.js: getCpiBatches / getCpiStudents / exportCpiStudents.
- Registers the tab in the officer and chairman tab sets and extends the api
  contract tests.
Put Student CPI first in the officer and chairman tab bars (so it is the
default view, which loads instantly until a batch is chosen) and reorder the
remaining tabs by how often they are used, keeping the full tab set intact.
Make the schedule and calendar fit how a placement cell actually works:

- Placement Calendar: full-height calendar, events colour-coded by type
  (Drive / Online Test / Interview / Deadline) with a legend, an added Agenda
  view, application deadlines surfaced as events, and event details shown in a
  popover instead of navigating away. Uses the mode/venue/end-time the API
  already returned but the old view ignored.
- Placement Schedule: lead with a chronological Agenda grouped Today / This
  Week / Upcoming / Closed (date, time, round, venue, deadline countdown,
  eligibility and applied badges), with a toggle back to the existing card
  grid and filters.
- Officer tabs: move Company Registration directly after Student CPI to match
  the placement workflow (students -> companies -> schedule -> outcomes).
- Load the placement module directly: import the landing page eagerly (like the
  other ERP modules) instead of lazily, so opening it from the sidebar renders
  immediately for every role rather than flashing a loading state; give the
  remaining lazy sub-pages a proper centered loader.
- Fix the date/time pickers: import @mantine/dates styles at the app root so the
  stylesheet loads after the core styles. Previously it was only imported deep
  inside a module and landed in the wrong order, collapsing the calendar grid to
  a single (Monday) column. Start and end pickers now show a full month calendar
  with time.
- Branch is now fetched from /placement/api/branches/ (real department names) and
  selectable as multiple branches, instead of a hard-coded list.
- Application fields are now optional and clearly explained (what they are and
  where to manage them) instead of being silently required.
- Replace the toggle-button eligibility controls with an always-visible optional
  Eligibility Criteria section (min CPI, passout year, gender, branches) and
  record a readable eligibility summary for students.
Mantine's calendar dropdown rendered only a single (Monday) column in this app
regardless of stylesheet order, so replace it with native datetime-local/date
inputs in the placement forms. These give a complete, reliable browser calendar
plus time picker with no dependency on Mantine's calendar styling:

- Add Placement Event: start and end are now datetime-local inputs.
- Off-Campus Placement: offer date is now a native date input.

Also drop LoadingSpinner's defaultProps in favour of a default parameter to
clear the React deprecation warning.
…ops warning

- Off-Campus offer: the Company field is now a searchable autocomplete seeded
  from registered companies (company registration data), while still allowing a
  free-typed name for companies that never ran an on-campus drive.
- Remove React StrictMode: in development it double-invoked effects, so every
  data-fetching request fired twice (and any effect-driven side effect ran
  twice). This only ever happened in development, never in production, but it
  was confusing while testing; dev now matches production.
- Drop AddPlacementEventForm's defaultProps in favour of default parameters to
  clear the React deprecation warning.
Turn the placement calendar into an editable calendar for the TPO/chairman
while keeping it read-only for students:

- Click any date or time slot to add an event; click your own event to edit or
  delete it (create/edit/delete modal with title, category, start/end, all-day,
  venue and description).
- Free-form events are merged with the existing recruitment rounds and
  application deadlines, all colour-coded by category with a legend; derived
  drive/deadline events stay read-only with an Open-timeline link.
- Students and other roles get a non-selectable, view-only calendar.

Backed by the new /placement/api/calendar-events/ endpoints.
Application fields and restrictions lived only in separate tabs, so they were
easy to miss when creating a drive. Surface both in the drive form:

- Create a new application field inline (name, type, required) without leaving
  the form; it is created and auto-selected for the drive. The Fields tab
  remains the full manager.
- Show a read-only panel of the institute-wide restrictions that already apply
  automatically to every drive, so the officer knows they are in effect and
  does not try to re-enter them per drive (they stay global in the Restrictions
  tab).
The placement module statically imported all ~24 tab components, so opening it
pulled every table and the calendar (and their heavy libraries) into one ~3.7 MB
bundle up front — slow to download and parse, and especially slow in dev where
each module is a separate request.

- Lazy-load every tab in PlacementCellPage behind a Suspense boundary, so
  opening the module only loads the shell plus the active tab's code; switching
  tabs loads that tab on demand.
- Split heavy vendors (react-big-calendar, mantine-react-table, @Mantine,
  react, pdf libs) into separate long-term-cacheable chunks via Vite
  manualChunks.

Result: the main chunk drops from ~3.7 MB to ~1 MB and each placement tab is a
small 3-28 kB chunk loaded only when opened.
Add a README covering the role-based tab sets, key UI behaviour (agenda
schedule, interactive calendar, inline fields, branches from the API), the
lazy-loading/chunking performance setup, the code map and how to test.
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