Skip to content
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

Add info text to PPR admin table #176

Merged
merged 3 commits into from
Jan 1, 2024
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
2 changes: 2 additions & 0 deletions backend/models/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ const PPR_STATUS = [
'SEEKING_APPROVAL',
'READY_TO_BUY',
'PURCHASED_AND_RECEIPTS_SUBMITTED',
'REPORTER_PAID',
'REPORTER_REIMBURSE_CONFIRMED',
]
const PPR_STATUS_FUNDING_SPENT = [
'PURCHASED_AND_RECEIPTS_SUBMITTED',
'REPORTER_PAID',
'REPORTER_REIMBURSE_CONFIRMED',
]
const UPR_STATUS = [
Expand Down
8 changes: 5 additions & 3 deletions backend/service/personalpurchases.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ const updatePersonalPurchase = async (id, body) => {
})
const annotatedPPR = await getPersonalPurchase(id)
if (body?.status === 'PURCHASED_AND_RECEIPTS_SUBMITTED') {
sendEmailPPRPurchasedAndReceiptsSubmittedToCoordinator(annotatedPPR)
} else if (body?.status === 'REPORTER_REIMBURSE_CONFIRMATION') {
sendEmailPPRReimbursedToReporter(annotatedPPR)
await sendEmailPPRPurchasedAndReceiptsSubmittedToCoordinator(
annotatedPPR
)
} else if (body?.status === 'REPORTER_PAID') {
await sendEmailPPRReimbursedToReporter(annotatedPPR)
}
return newPurchaseTicket
}
Expand Down
44 changes: 39 additions & 5 deletions frontend/src/components/TicketContent/PPRAdminContentTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,48 @@ const PPRAdminContentTable = () => {
}
const getTransitionBody = () => {
switch (currentTicket.status) {
case 'SEEKING_APPROVAL':
return (
<>
<h1>No Current Actions Available</h1>
<h2>Will automatically transition to READY_TO_BUY</h2>
<h2>
Condition: All three approvals below must be checked
</h2>
</>
)
case 'READY_TO_BUY':
return (
<>
<h1>No Current Actions Available</h1>
<h2>
Will automatically transition to
PURCHASED_AND_RECEIPTS_SUBMITTED
</h2>
<h2>
Condition: Reporter uploads supporting documents and
manually transitions status
</h2>
</>
)
case 'PURCHASED_AND_RECEIPTS_SUBMITTED':
return getPurchasedAndReceiptsSubmittedBody()
default:
case 'REPORTER_PAID':
return (
<>
<h1>No Current Actions Available</h1>
<h2>
Will automatically transition to
REPORTER_REIMBURSE_CONFIRMED
</h2>
<h2>
Condition: Reporter confirms they have been
reimbursed and manually transitions status
</h2>
</>
)
default:
return <h1>No Current Actions Available</h1>
}
}
const getPurchasedAndReceiptsSubmittedBody = () => {
Expand All @@ -38,9 +72,7 @@ const PPRAdminContentTable = () => {
<Button
colorScheme="blue"
size="sm"
onClick={() =>
handleUpdateStatus('REPORTER_REIMBURSE_CONFIRMATION')
}
onClick={() => handleUpdateStatus('REPORTER_PAID')}
>
Confirm Reporter Reimbursed
</Button>
Expand All @@ -55,7 +87,9 @@ const PPRAdminContentTable = () => {
mb="30px"
>
<Heading size="md">Admin View</Heading>
<Center pb="7px">{getTransitionBody()}</Center>
<Center pb="7px" flexDir="column" textAlign="center" gap="8px">
{getTransitionBody()}
</Center>
</VStack>
)
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/TicketContent/PPRReporterTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const PPRReporterTable = ({ currentTicket, supportingDocuments }) => {
size="sm"
mr="20px"
onClick={() => {
transitionStatus('REPORTER_REIMBURSED')
transitionStatus('REPORTER_REIMBURSE_CONFIRMED')
}}
disabled={supportingDocuments.length === 0}
>
Expand All @@ -62,7 +62,7 @@ const PPRReporterTable = ({ currentTicket, supportingDocuments }) => {
switch (currentTicket.status) {
case 'READY_TO_BUY':
return getPurchasedAndRequestReimbursementBody()
case 'REPORTER_REIMBURSE_CONFIRMATION':
case 'REPORTER_PAID':
return getReimbursementConfirmationBody()
default:
return (
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ const Dashboard = () => {
return (
<>
{auth.isAdmin && <PPRAdminContentTable />}
{isReporter() && (
{(isReporter() || auth.isAdmin) && (
<PPRReporterTable
supportingDocuments={supportingDocuments}
currentTicket={currentTicket}
Expand Down
Loading