diff --git a/server/src/main/java/com/objectcomputing/checkins/services/memberprofile/birthday/BirthDayServicesImpl.java b/server/src/main/java/com/objectcomputing/checkins/services/memberprofile/birthday/BirthDayServicesImpl.java index bea821aa58..d241cd3786 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/memberprofile/birthday/BirthDayServicesImpl.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/memberprofile/birthday/BirthDayServicesImpl.java @@ -23,6 +23,13 @@ public BirthDayServicesImpl(MemberProfileServices memberProfileServices) { public List findByValue(String[] months, Integer[] daysOfMonth) { Set memberProfiles = memberProfileServices.findByValues(null, null, null, null, null, null, false); List memberProfileAll = new ArrayList<>(memberProfiles); + if (months == null && daysOfMonth == null) { + // If nothing was passed in, get all members without birthdays. + memberProfileAll = memberProfileAll + .stream() + .filter(member -> member.getBirthDate() == null) + .toList(); + } if (months != null) { for (String month : months) { if (month != null) { @@ -66,7 +73,9 @@ private List profileToBirthDateResponseDto(List { export const getBirthdays = async (months, cookie) => { const results = []; - for (let month of months) { + if (months) { + for (let month of months) { + const res = await resolve({ + url: `${birthdayReportUrl}?month=${month}`, + headers: { 'X-CSRF-Header': cookie, Accept: 'application/json' } + }); + if (res.error) { + console.error(res.error); + } else { + results.push(...res.payload.data); + } + } + } else { const res = await resolve({ - url: `${birthdayReportUrl}?month=${month}`, + url: birthdayReportUrl, headers: { 'X-CSRF-Header': cookie, Accept: 'application/json' } }); - results.push(...res.payload.data); + if (res.error) { + console.error(res.error); + } else { + results.push(...res.payload.data); + } } return results; }; diff --git a/web-ui/src/pages/BirthdayAnniversaryReportPage.css b/web-ui/src/pages/BirthdayAnniversaryReportPage.css index 5e40155dc2..b706346b30 100644 --- a/web-ui/src/pages/BirthdayAnniversaryReportPage.css +++ b/web-ui/src/pages/BirthdayAnniversaryReportPage.css @@ -20,7 +20,6 @@ .select-month { display: flex; - justify-content: space-between; align-items: center; margin-left: 15px; margin-right: 10px; diff --git a/web-ui/src/pages/BirthdayReportPage.jsx b/web-ui/src/pages/BirthdayReportPage.jsx index c9aa348b92..af16520155 100644 --- a/web-ui/src/pages/BirthdayReportPage.jsx +++ b/web-ui/src/pages/BirthdayReportPage.jsx @@ -2,7 +2,7 @@ import React, { useContext, useState } from 'react'; import { AppContext } from '../context/AppContext'; -import { Button, TextField } from '@mui/material'; +import { FormControlLabel, Switch, Button, TextField } from '@mui/material'; import Autocomplete from '@mui/material/Autocomplete'; import './BirthdayAnniversaryReportPage.css'; @@ -45,6 +45,7 @@ const BirthdayReportPage = () => { const [selectedMonths, setSelectedMonths] = useState(defaultMonths); const [hasSearched, setHasSearched] = useState(false); const [loading, setLoading] = useState(false); + const [noBirthday, setNoBirthday] = useState(false); useQueryParameters([ { @@ -61,7 +62,8 @@ const BirthdayReportPage = () => { const handleSearch = async monthsToSearch => { setLoading(true); try { - const birthdayResults = await getBirthdays(monthsToSearch, csrf); + const birthdayResults = await getBirthdays(noBirthday ? null : + monthsToSearch, csrf); setSearchBirthdayResults(sortBirthdays(birthdayResults)); setHasSearched(true); } catch(e) { @@ -101,12 +103,25 @@ const BirthdayReportPage = () => { placeholder="Choose a month" /> )} + disabled={noBirthday} + /> + { + const { checked } = event.target; + setNoBirthday(checked); + }} + /> + } + label="No Birthday Registered" />
+