Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,6 @@
"Do Not Import": "Do Not Import",
"DO NOT MERGE MINISTRY ACCOUNTS THROUGH {{appName}}": "DO NOT MERGE MINISTRY ACCOUNTS THROUGH {{appName}}",
"Do not move a contact into this column called \"Received\". Due to an outdated feature, contacts must first be moved to \"Committed\". If the gift has been recorded, you can then move the contact into the column called \"Given\".": "Do not move a contact into this column called \"Received\". Due to an outdated feature, contacts must first be moved to \"Committed\". If the gift has been recorded, you can then move the contact into the column called \"Given\".",
"Do Not Remind": "Do Not Remind",
"Do you live within 50 miles of one of these major cities?": "Do you live within 50 miles of one of these major cities?",
"Do you receive donations in any other country or from any other organizations?": "Do you receive donations in any other country or from any other organizations?",
"Do you want to cancel your {{formTitle}}?": "Do you want to cancel your {{formTitle}}?",
Expand Down Expand Up @@ -1959,8 +1958,8 @@
"Not applicable": "Not applicable",
"Not equals": "Not equals",
"Not Interested": "Not Interested",
"Not Reminded": "Not Reminded",
"Not taxed now": "Not taxed now",
"Not Yet Enrolled": "Not Yet Enrolled",
"Note": "Note",
"Note (Optional)": "Note (Optional)",
"Note: Italy staff must complete a paper MHI form.": "Note: Italy staff must complete a paper MHI form.",
Expand Down Expand Up @@ -2283,6 +2282,7 @@
"Request processed on": "Request processed on",
"Request processed on:": "Request processed on:",
"Request Summary": "Request Summary",
"Requested No Reminder": "Requested No Reminder",
"Requested on": "Requested on",
"Requested on:": "Requested on:",
"Requested salary": "Requested salary",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('PartnerRemindersReport', () => {
expect(names).toHaveLength(2);
expect(getAllByText('Jan 15, 2023')).toHaveLength(2);
expect(getAllByText('Feb 15, 2023')).toHaveLength(2);
expect(getByText('Not Reminded')).toBeInTheDocument();
expect(getByText('Not Yet Enrolled')).toBeInTheDocument();
});

it('should call update mutation when changing reminder status and clicking save', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ describe('RemindersTable', () => {
expect(date).toBeTruthy();

const select = getAllByRole('combobox', { name: /reminder status/i });
expect(select[0]).toHaveTextContent('Not Reminded');
expect(select[0]).toHaveTextContent('Not Yet Enrolled');
});

it('should change the select value', async () => {
const { getAllByRole, getByRole } = render(<TestComponent />);

const select = getAllByRole('combobox', { name: /reminder status/i });
expect(select[0]).toHaveTextContent('Not Reminded');
expect(select[0]).toHaveTextContent('Not Yet Enrolled');

await userEvent.click(select[0]);
const option = getByRole('option', { name: 'Monthly' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,29 @@ type StatusSelectProps = Omit<SelectProps, 'value'> & {
value: MinistryPartnerReminderFrequencyEnum;
};

const statusOrder: Record<MinistryPartnerReminderFrequencyEnum, number> = {
[MinistryPartnerReminderFrequencyEnum.Monthly]: 0,
[MinistryPartnerReminderFrequencyEnum.Bimonthly]: 1,
[MinistryPartnerReminderFrequencyEnum.Quarterly]: 2,
[MinistryPartnerReminderFrequencyEnum.SemiAnnually]: 3,
[MinistryPartnerReminderFrequencyEnum.Annually]: 4,
[MinistryPartnerReminderFrequencyEnum.DoNotRemind]: 5,
[MinistryPartnerReminderFrequencyEnum.NotReminded]: 6,
};

const orderedStatuses = Object.values(
MinistryPartnerReminderFrequencyEnum,
).sort((a, b) => statusOrder[a] - statusOrder[b]);

export const StatusSelect: React.FC<StatusSelectProps> = ({
value,
...props
}) => {
const { t } = useTranslation();
return (
<FormControl size={'small'} sx={{ width: 150 }}>
<FormControl size={'small'} sx={{ width: '100%', minWidth: 200 }}>
<Select {...props} value={value} sx={{ backgroundColor: 'common.white' }}>
{Object.values(MinistryPartnerReminderFrequencyEnum).map((status) => (
{orderedStatuses.map((status) => (
<MenuItem key={status} value={status}>
{getLocalizedReminderStatus(t, status)}
</MenuItem>
Expand Down
8 changes: 4 additions & 4 deletions src/lib/functions/getLocalizedReminderStatus.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ describe('getLocalizedReminderStatus', () => {
[MinistryPartnerReminderFrequencyEnum.Quarterly, 'Quarterly'],
[MinistryPartnerReminderFrequencyEnum.SemiAnnually, 'Semi-Annually'],
[MinistryPartnerReminderFrequencyEnum.Annually, 'Annually'],
[MinistryPartnerReminderFrequencyEnum.DoNotRemind, 'Do Not Remind'],
[MinistryPartnerReminderFrequencyEnum.NotReminded, 'Not Reminded'],
[MinistryPartnerReminderFrequencyEnum.DoNotRemind, 'Requested No Reminder'],
[MinistryPartnerReminderFrequencyEnum.NotReminded, 'Not Yet Enrolled'],
])('maps %s to "%s"', (status, expected) => {
expect(getLocalizedReminderStatus(t, status)).toBe(expected);
});

it('falls back to "Not Reminded" for undefined', () => {
expect(getLocalizedReminderStatus(t, undefined)).toBe('Not Reminded');
it('falls back to "Not Yet Enrolled" for undefined', () => {
expect(getLocalizedReminderStatus(t, undefined)).toBe('Not Yet Enrolled');
});
});
4 changes: 2 additions & 2 deletions src/lib/functions/getLocalizedReminderStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export const getLocalizedReminderStatus = (
case MinistryPartnerReminderFrequencyEnum.Annually:
return t('Annually');
case MinistryPartnerReminderFrequencyEnum.DoNotRemind:
return t('Do Not Remind');
return t('Requested No Reminder');
case MinistryPartnerReminderFrequencyEnum.NotReminded:
default:
return t('Not Reminded');
return t('Not Yet Enrolled');
Comment thread
wjames111 marked this conversation as resolved.
}
};
Loading