Skip to content

Commit 6eedfbc

Browse files
committed
got rid of checklist on RR creation and fixed autocomplete for delegates
1 parent 9b58b3c commit 6eedfbc

2 files changed

Lines changed: 11 additions & 57 deletions

File tree

src/frontend/src/pages/AdminToolsPage/FinanceConfig/FinanceDelegatesTable.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import LoadingIndicator from '../../../components/LoadingIndicator';
1414
import ErrorPage from '../../ErrorPage';
1515
import React, { useState } from 'react';
16-
import { User } from 'shared';
1716
import { NERButton } from '../../../components/NERButton';
1817
import DeleteIcon from '@mui/icons-material/Delete';
1918
import { useGetFinanceDelegates, useSetFinanceDelegates } from '../../../hooks/organizations.hooks';
@@ -34,9 +33,9 @@ const FinanceDelegatesTable = () => {
3433
const { mutateAsync: setFinanceDelegates, isLoading: isUpdating } = useSetFinanceDelegates();
3534
const toast = useToast();
3635

37-
const [selectedUser, setSelectedUser] = useState<User | null>(null);
36+
const [selectedUserId, setSelectedUserId] = useState<string>();
3837

39-
if (!financeDelegates || delegatesIsLoading || usersIsLoading) {
38+
if (!financeDelegates || delegatesIsLoading || !allUsers || usersIsLoading) {
4039
return <LoadingIndicator />;
4140
}
4241

@@ -49,12 +48,12 @@ const FinanceDelegatesTable = () => {
4948
}
5049

5150
const handleAddDelegate = async () => {
52-
if (!selectedUser) return;
51+
if (!selectedUserId) return;
5352

5453
try {
55-
const updatedUserIds = [...financeDelegates.map((u) => u.userId), selectedUser.userId];
54+
const updatedUserIds = [...financeDelegates.map((u) => u.userId), selectedUserId];
5655
await setFinanceDelegates(updatedUserIds);
57-
setSelectedUser(null);
56+
setSelectedUserId(undefined);
5857
toast.success('Finance delegate added successfully');
5958
} catch (error: any) {
6059
toast.error(error.message);
@@ -75,9 +74,8 @@ const FinanceDelegatesTable = () => {
7574
allUsers?.filter((user) => !financeDelegates.some((delegate) => delegate.userId === user.userId)) || [];
7675

7776
const userAutocompleteOptions = availableUsers.map((user) => ({
78-
label: fullNamePipe(user),
79-
id: user.userId,
80-
user
77+
label: `${fullNamePipe(user)} (${user.email})`,
78+
id: user.userId
8179
}));
8280

8381
const delegateTableRows = financeDelegates.map((delegate, index) => (
@@ -107,18 +105,18 @@ const FinanceDelegatesTable = () => {
107105
<Autocomplete
108106
sx={{ width: 300 }}
109107
options={userAutocompleteOptions}
110-
value={selectedUser ? { label: fullNamePipe(selectedUser), id: selectedUser.userId, user: selectedUser } : null}
108+
getOptionLabel={(option) => option.label}
109+
value={userAutocompleteOptions.find((option) => option.id === selectedUserId) || null}
111110
onChange={(_event, newValue) => {
112-
setSelectedUser(newValue?.user || null);
111+
setSelectedUserId(newValue?.id || undefined);
113112
}}
114113
renderInput={(params) => <TextField {...params} variant="standard" placeholder="Select a User" />}
115-
isOptionEqualToValue={(option, value) => option.id === value.id}
116114
/>
117115
<NERButton
118116
style={{ color: 'white' }}
119117
variant="contained"
120118
onClick={handleAddDelegate}
121-
disabled={!selectedUser || isUpdating}
119+
disabled={!selectedUserId || isUpdating}
122120
>
123121
Add Delegate
124122
</NERButton>

src/frontend/src/pages/FinancePage/ReimbursementRequestForm/ReimbursementFormView.tsx

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ import { Link as RouterLink } from 'react-router-dom';
5454
import { routes } from '../../../utils/routes';
5555
import { wbsNumComparator } from 'shared/src/validate-wbs';
5656
import { codeAndRefundSourceName, accountCodePipe, fullNamePipe } from '../../../utils/pipes';
57-
import NERModal from '../../../components/NERModal';
58-
import CheckList from '../../../components/CheckList';
5957
import { useCreateVendor } from '../../../hooks/finance.hooks';
6058
import { useGetFinanceDelegates } from '../../../hooks/organizations.hooks';
6159
import LoadingIndicator from '../../../components/LoadingIndicator';
@@ -226,7 +224,6 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
226224
const calculatedTotalCost = products
227225
.reduce((acc: number, product: ReimbursementProductFormArgs) => acc + Number(product.cost), 0)
228226
.toFixed(2);
229-
const [showReimbursementGuidelinesModal, setShowReimbursementGuidelinesModal] = useState(true);
230227

231228
const wbsElementAutocompleteOptions = allWbsElements.map((wbsElement) => ({
232229
label: wbsPipe(wbsElement.wbsNum) + ' - ' + wbsElement.wbsName,
@@ -292,46 +289,6 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
292289
</FormControl>
293290
);
294291

295-
const ReimbursementGuidelinesModal = () => (
296-
<NERModal
297-
open={showReimbursementGuidelinesModal}
298-
onHide={() => setShowReimbursementGuidelinesModal(false)}
299-
title="Finance Checklist"
300-
cancelText="No"
301-
submitText="Yes"
302-
onSubmit={() => setShowReimbursementGuidelinesModal(false)}
303-
>
304-
<CheckList
305-
title="Receipts must have the following: "
306-
items={[
307-
{
308-
resolved: false,
309-
detail: `I certify that I have a Concur account${financeDelegates.length > 0 ? ', and have assigned ' + financeDelegates.map(fullNamePipe).join(', ') + ' as delegate(s) to submit this reimbursement request on my behalf.' : '.'}`,
310-
id: '1'
311-
},
312-
{
313-
resolved: false,
314-
detail:
315-
'I certify my receipts with expenses greater than $75 include an itemized description of goods or service purchased.',
316-
id: '2'
317-
},
318-
{
319-
resolved: false,
320-
detail: `This reimbursement request is "NOT" for a faculty or full-time staff member.`,
321-
id: '3'
322-
},
323-
{
324-
resolved: false,
325-
detail: `The reimbursement does not include sales tax unless it is for a prepared meal or hotel.`,
326-
id: '4'
327-
}
328-
]}
329-
isDisabled={false}
330-
checkDescriptionBullets={false}
331-
/>
332-
</NERModal>
333-
);
334-
335292
const accountCodesToAutocomplete = (accountCode: AccountCode): { label: string; id: string } => {
336293
return {
337294
label: accountCodePipe(accountCode),
@@ -356,7 +313,6 @@ const ReimbursementRequestFormView: React.FC<ReimbursementRequestFormViewProps>
356313
justifyContent: 'space-between'
357314
}}
358315
>
359-
<ReimbursementGuidelinesModal />
360316
{!hasSecureSettingsSet && (
361317
<Snackbar anchorOrigin={{ vertical: 'top', horizontal: 'center' }} open={true}>
362318
<Alert variant="filled" severity="warning">

0 commit comments

Comments
 (0)