-
Notifications
You must be signed in to change notification settings - Fork 9
Working new admin tools tables #3428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wavehassman
merged 14 commits into
feature/finance-redesign
from
working-new-admin-tools-tables
Apr 30, 2025
Merged
Changes from 12 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
0031adc
account manager table
vsp05 10bed0d
layout for categories table
vsp05 176aa62
going to bed 💤🥱🛌 - next ill out indexcodeformmodal
vsp05 de255b0
blah blah blha blah
vsp05 6c22df2
Revert "blah blah blha blah"
vsp05 4b9fd95
final tables
vsp05 0bada8f
ui for accountcodeformmodal
vsp05 521946f
Merge branch 'feature/finance-redesign' into working-new-admin-tools-…
vsp05 43dbaf2
fix titles
vsp05 186b070
cleaning up code for now
vsp05 98bf67e
cleaning up more code'
vsp05 351013e
lint and prettier
vsp05 ded0db7
initialize Set in one line
vsp05 75ba59e
Merge branch 'feature/finance-redesign' into working-new-admin-tools-…
vsp05 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 13 additions & 10 deletions
23
src/frontend/src/pages/AdminToolsPage/AdminToolsFinanceConfig.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 0 additions & 90 deletions
90
src/frontend/src/pages/AdminToolsPage/FinanceConfig/AccountCodesTable.tsx
This file was deleted.
Oops, something went wrong.
116 changes: 116 additions & 0 deletions
116
src/frontend/src/pages/AdminToolsPage/FinanceConfig/AccountManagerTable.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| import { TableRow, TableCell, Typography, Box, TableHead, Table, TableBody, Checkbox } from '@mui/material'; | ||
| import LoadingIndicator from '../../../components/LoadingIndicator'; | ||
| import { useGetAllAccountCodes } from '../../../hooks/finance.hooks'; | ||
| import ErrorPage from '../../ErrorPage'; | ||
| import React, { useState } from 'react'; | ||
| import { AccountCode } from 'shared'; | ||
| import CreateAccountCodeModal from './CreateAccountCodeModal'; | ||
| import EditAccountCodeModal from './EditAccountCodeModal'; | ||
| import { NERButton } from '../../../components/NERButton'; | ||
|
|
||
| const AccountManagerTable = () => { | ||
| const { | ||
| data: accountCodes, | ||
| isLoading: accountCodesIsLoading, | ||
| isError: accountCodesIsError, | ||
| error: accountCodesError | ||
| } = useGetAllAccountCodes(); | ||
| const [showCreateModal, setShowCreateModal] = useState<boolean>(false); | ||
| const [showEditModal, setShowEditModal] = useState<boolean>(false); | ||
| const [clickedAccountCode, setClickedAccountCode] = useState<AccountCode>(); | ||
|
|
||
| if (!accountCodes || accountCodesIsLoading) { | ||
| return <LoadingIndicator />; | ||
| } | ||
|
|
||
| if (accountCodesIsError) { | ||
| return <ErrorPage message={accountCodesError.message} />; | ||
| } | ||
|
|
||
| const uniqueIndexCodeNames = (accountCode: AccountCode) => { | ||
| const uniqueNames = new Set(); | ||
|
|
||
| accountCode.indexCodes.forEach((indexCode) => uniqueNames.add(indexCode.name)); | ||
| return Array.from(uniqueNames).join(', '); | ||
| }; | ||
|
|
||
| const accountManagerTableRows = accountCodes.map((accountCode, index) => ( | ||
| <TableRow | ||
| onClick={() => { | ||
| setClickedAccountCode(accountCode); | ||
| setShowEditModal(true); | ||
| }} | ||
| key={`account-code-${index}`} | ||
| sx={{ cursor: 'pointer' }} | ||
| > | ||
| <TableCell> | ||
| <Typography>{uniqueIndexCodeNames(accountCode)}</Typography> | ||
| </TableCell> | ||
| <TableCell> | ||
| <Typography>{accountCode.code}</Typography> | ||
| </TableCell> | ||
| <TableCell> | ||
| <Typography>{accountCode.name}</Typography> | ||
| </TableCell> | ||
| <TableCell> | ||
| <Checkbox checked={accountCode.allowed} /> | ||
| </TableCell> | ||
| </TableRow> | ||
| )); | ||
|
|
||
| const columns = ['Index Code', 'Account Code', 'Description', 'Allowed']; | ||
|
|
||
| return ( | ||
| <Box> | ||
| <Box sx={{ display: 'flex', justifyContent: 'left', marginTop: '20px', paddingBottom: '20px' }}> | ||
| <Typography variant="h5" gutterBottom color="white" paddingRight={'20px'}> | ||
| Account Manager | ||
| </Typography> | ||
| <NERButton | ||
| style={{ color: 'white' }} | ||
| variant="contained" | ||
| onClick={() => { | ||
| setShowCreateModal(true); | ||
| }} | ||
| > | ||
| Add Account | ||
| </NERButton> | ||
| </Box> | ||
| <CreateAccountCodeModal showModal={showCreateModal} handleClose={() => setShowCreateModal(false)} /> | ||
| {clickedAccountCode && ( | ||
| <EditAccountCodeModal | ||
| showModal={showEditModal} | ||
| handleClose={() => { | ||
| setShowEditModal(false); | ||
| setClickedAccountCode(undefined); | ||
| }} | ||
| accountCode={clickedAccountCode} | ||
| /> | ||
| )} | ||
| <Table> | ||
| <TableHead> | ||
| <TableRow> | ||
| {columns.map((column, index) => ( | ||
| <TableCell | ||
| key={`account-code-column-${index}`} | ||
| sx={{ | ||
| borderBottom: '2px solid white', | ||
| fontWeight: 'bold', | ||
| fontSize: '1em', | ||
| backgroundColor: '#ef4345', | ||
| color: 'white', | ||
| borderRadius: index === 0 ? '10px 0px 0px 0px' : index === columns.length - 1 ? '0px 10px 0px 0px' : '0px' | ||
| }} | ||
| > | ||
| {column} | ||
| </TableCell> | ||
| ))} | ||
| </TableRow> | ||
| </TableHead> | ||
| <TableBody>{accountManagerTableRows} </TableBody> | ||
| </Table> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default AccountManagerTable; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.