diff --git a/frontend/src/screens/Jobs.jsx b/frontend/src/screens/Jobs.jsx index 870c1c1..44fea39 100644 --- a/frontend/src/screens/Jobs.jsx +++ b/frontend/src/screens/Jobs.jsx @@ -41,6 +41,14 @@ async function fetchJobs() { return rows.map(jobsApi.toJobView) } +function deptValue(j) { + return String(j.requisitionDepartment || j.department || '').trim() +} + +function deptLabel(j) { + return deptValue(j) || '—' +} + function splitLines(text) { return String(text || '') .split('\n') @@ -193,7 +201,7 @@ export default function Jobs() { }) const departmentOptions = useMemo( - () => [...new Set(jobs.map((j) => j.department).filter(Boolean))].sort(), + () => [...new Set(jobs.map(deptValue).filter(Boolean))].sort(), [jobs], ) const typeOptions = useMemo( @@ -204,12 +212,12 @@ export default function Jobs() { const rows = useMemo( () => jobs.filter((j) => { - if (dept && j.department !== dept) return false + if (dept && deptValue(j) !== dept) return false if (status && j.status !== status) return false if (type && j.type !== type) return false if (q) { const term = q.toLowerCase() - const hay = [j.title, j.department, j.recruiter, j.hiringManager, j.location] + const hay = [j.title, deptValue(j), j.recruiter, j.hiringManager, j.location] .filter(Boolean) .join(' ') .toLowerCase() @@ -242,11 +250,11 @@ export default function Jobs() { render: (j) => ( <>
{j.title}
-
{j.department || '—'}
+
{deptLabel(j)}
), }, - { key: 'department', label: 'Department', sortable: true, render: (j) => j.department || '—' }, + { key: 'department', label: 'Department', sortable: true, sortValue: deptValue, render: (j) => deptLabel(j) }, { key: 'location', label: 'Location', sortable: true, render: (j) => {j.location || '—'} }, { key: 'type', label: 'Type', render: (j) => j.type ? {j.type} : '—' }, { key: 'platform', label: 'Platform', sortable: true, sortValue: (j) => platformLabel(j.platform), render: (j) => j.platform ? {platformLabel(j.platform)} : '—' }, @@ -998,7 +1006,7 @@ function EditJobForm({ job: j, departmentOptions, busy, onClose, onSubmit }) { return (
{j.title}
-
{[j.department, j.location].filter(Boolean).join(' · ') || '—'}
+
{[deptValue(j), j.location].filter(Boolean).join(' · ') || '—'}
{canEdit ? ( @@ -1396,7 +1404,7 @@ function JobDetail({ {tab === 'details' && ( <>
-
Department
{j.department || '—'}
+
Department
{deptLabel(j)}
Location
{j.location || '—'}
Employment Type
{j.type || '—'}
Platform
{platformLabel(j.platform) || '—'}