Skip to content

Commit

Permalink
Merge pull request #2291 from HHS/al-ttahub-3196-new-tr-views
Browse files Browse the repository at this point in the history
[TTAHUB-3196] Update TR views to make life easier for users
  • Loading branch information
AdamAdHocTeam authored Aug 29, 2024
2 parents 7610fd4 + 79ede19 commit c4a60c3
Show file tree
Hide file tree
Showing 126 changed files with 5,677 additions and 4,104 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ parameters:
type: string
dev_git_branch: # change to feature branch to test deployment
description: "Name of github branch that will deploy to dev"
default: "TTAHUB-3097/transactions-for-workers-round-2"
default: "al-ttahub-3196-new-tr-views"
type: string
sandbox_git_branch: # change to feature branch to test deployment
default: "mb/TTAHUB-3198/training-report-alerts"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ tests/api/report
tests/e2e/report
tests/e2e/test-results
tests/api/test-results
test-results

# Ignore /doc => /docs symbolic link created for adr-tools
/doc
Expand Down
2 changes: 1 addition & 1 deletion email_templates/tr_collaborator_added/html.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ style
include ../email.css
p Hello,
p You've been added as an event collaborator on Training Report #{displayId}.
p Access this report in the TTA Hub:
p Select the link below to review and submit the event details in the TTA Hub:
ul
li
a(href=reportPath)= displayId
Expand Down
2 changes: 1 addition & 1 deletion email_templates/tr_collaborator_added/subject.pug
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= `You have been added to Training Report ${displayId}`
= `Action needed: Submit event details for Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_collaborator_reminder_event/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as an Event Collaborator on Training Report #{displayId}.
p Select the link below to access the report in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
1 change: 1 addition & 0 deletions email_templates/tr_collaborator_reminder_event/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Submit event details for Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_collaborator_reminder_no_sessions/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as an Event Collaborator on Training Report #{displayId}.
p Select the link below to create a session in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Create a session for Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_collaborator_reminder_session/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as an Event Collaborator on Training Report #{displayId}.
p Select the link below to review and submit the session details in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Submit session details for Training Report ${displayId}`
2 changes: 1 addition & 1 deletion email_templates/tr_event_complete/html.pug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ style
include ../email.css
p Hello,
p Training Report #{displayId} has been completed.
p Access this report in the TTA Hub:
p Select the link below to access the report in the TTA Hub:
ul
li
a(href=reportPath)= displayId
Expand Down
2 changes: 1 addition & 1 deletion email_templates/tr_event_complete/subject.pug
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= `A Training Report has been completed`
= `Training Report ${displayId} has been completed!`
11 changes: 11 additions & 0 deletions email_templates/tr_event_imported/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p You've been assigned as an Event Creator on Training Report #{displayId}.
p Select the link below to review and submit the event details in the TTA Hub::
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
1 change: 1 addition & 0 deletions email_templates/tr_event_imported/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `Action needed: Submit event details for Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_owner_reminder_event/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as an Event Creator on Training Report #{displayId}.
p Select the link below to access the report in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
1 change: 1 addition & 0 deletions email_templates/tr_owner_reminder_event/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Submit event details for Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_owner_reminder_event_not_completed/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that Training Report #{displayId} is ready for your review.
p Select the link below to review and complete the event in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Complete Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_owner_reminder_no_sessions/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as an Event Creator on Training Report #{displayId}.
p Select the link below to create a session in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
1 change: 1 addition & 0 deletions email_templates/tr_owner_reminder_no_sessions/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Create a session for Training Report ${displayId}`
11 changes: 11 additions & 0 deletions email_templates/tr_owner_reminder_session/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as an Event Creator on Training Report #{displayId}.
p Select the link below to review and submit the session details in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
1 change: 1 addition & 0 deletions email_templates/tr_owner_reminder_session/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Submit session details for Training Report ${displayId}`
11 changes: 0 additions & 11 deletions email_templates/tr_poc_added/html.pug

This file was deleted.

1 change: 0 additions & 1 deletion email_templates/tr_poc_added/subject.pug

This file was deleted.

11 changes: 11 additions & 0 deletions email_templates/tr_poc_reminder_session/html.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
style
include ../email.css
p Hello,
p This is a reminder that you have been assigned as a Regional POC on Training Report #{displayId}.
p Select the link below to review and submit the session details in the TTA Hub:
ul
li
a(href=reportPath)= displayId
p Best Regards,
br
| Your TTA Hub team
1 change: 1 addition & 0 deletions email_templates/tr_poc_reminder_session/subject.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
= `${prefix} Submit session details for Training Report ${displayId}`
11 changes: 0 additions & 11 deletions email_templates/tr_poc_session_complete/html.pug

This file was deleted.

1 change: 0 additions & 1 deletion email_templates/tr_poc_session_complete/subject.pug

This file was deleted.

11 changes: 0 additions & 11 deletions email_templates/tr_poc_vision_complete/html.pug

This file was deleted.

1 change: 0 additions & 1 deletion email_templates/tr_poc_vision_complete/subject.pug

This file was deleted.

11 changes: 0 additions & 11 deletions email_templates/tr_session_completed/html.pug

This file was deleted.

1 change: 0 additions & 1 deletion email_templates/tr_session_completed/subject.pug

This file was deleted.

4 changes: 2 additions & 2 deletions email_templates/tr_session_created/html.pug
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
style
include ../email.css
p Hello,
p A session has been created for Training Report #{displayId}.
p Access this report in the TTA Hub:
p You have been added as a Regional POC on #{displayId}.
p Select the link below to review and submit the session details in the TTA Hub:
ul
li
a(href=reportPath)= displayId
Expand Down
2 changes: 1 addition & 1 deletion email_templates/tr_session_created/subject.pug
Original file line number Diff line number Diff line change
@@ -1 +1 @@
= `A session has been created for Training Report ${displayId}`
= `Action needed: Submit session details for Training Report ${displayId}`
6 changes: 6 additions & 0 deletions frontend/src/App.scss
Original file line number Diff line number Diff line change
Expand Up @@ -445,3 +445,9 @@ fill: #1B1B1B;
overflow: hidden;
text-overflow: ellipsis;
}

.lead-paragraph {
font-family: "Merriweather Web", Georgia, Cambria, "Times New Roman", Times, serif;
font-size: 1.25rem;
line-height: 1.5;
}
39 changes: 39 additions & 0 deletions frontend/src/__tests__/permissions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import isAdmin, {
canChangeObjectiveStatus,
canChangeGoalStatus,
canEditOrCreateGoals,
hasTrainingReportWritePermissions,
} from '../permissions';

describe('permissions', () => {
Expand Down Expand Up @@ -376,4 +377,42 @@ describe('permissions', () => {
expect(result).toBe(false);
});
});

describe('hasTrainingReportWritePermissions', () => {
it('returns true if the user has read_write_training_repotrs', () => {
const user = {
permissions: [
{
scopeId: SCOPE_IDS.READ_WRITE_TRAINING_REPORTS,
regionId: 1,
},
],
};
expect(hasTrainingReportWritePermissions(user)).toBeTruthy();
});

it('returns true if the user has POC training reports', () => {
const user = {
permissions: [
{
scopeId: SCOPE_IDS.POC_TRAINING_REPORTS,
regionId: 1,
},
],
};
expect(hasTrainingReportWritePermissions(user)).toBeTruthy();
});

it('returns false otherwise', () => {
const user = {
permissions: [
{
scopeId: SCOPE_IDS.READ_REPORTS,
regionId: 1,
},
],
};
expect(hasTrainingReportWritePermissions(user)).toBeFalsy();
});
});
});
15 changes: 13 additions & 2 deletions frontend/src/components/ApprovedReportSpecialButtons.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Grid, ModalToggleButton } from '@trussworks/react-uswds';
import { Grid, ModalToggleButton, Button } from '@trussworks/react-uswds';
import { canUnlockReports } from '../permissions';
import PrintToPdf from './PrintToPDF';

Expand All @@ -9,6 +9,8 @@ export default function ApprovedReportSpecialButtons({
modalRef,
user,
showUnlockReports,
showCompleteEvent,
onCompleteEvent,
}) {
const [successfullyCopiedClipboard, setSuccessfullyCopiedClipboard] = useState(false);
const [somethingWentWrongWithClipboard, setSomethingWentWrongWithClipboard] = useState(false);
Expand Down Expand Up @@ -53,12 +55,17 @@ export default function ApprovedReportSpecialButtons({
: null}
<Grid row>
{navigator && navigator.clipboard
? <button id="approved-url" type="button" className="usa-button no-print" disabled={modalRef && modalRef.current ? modalRef.current.modalIsOpen : false} onClick={handleCopyUrl}>Copy URL Link</button>
? <button id="approved-url" type="button" className="usa-button usa-button--outline no-print" disabled={modalRef && modalRef.current ? modalRef.current.modalIsOpen : false} onClick={handleCopyUrl}>Copy URL Link</button>
: null}
<PrintToPdf
id="approved-print"
disabled={modalRef && modalRef.current ? modalRef.current.modalIsOpen : false}
/>
{(showCompleteEvent && onCompleteEvent) ? (
<Button onClick={onCompleteEvent} className="no-print">
Complete event
</Button>
) : null}
{showUnlockReports && user && user.permissions && canUnlockReports(user)
? <ModalToggleButton type="button" className="usa-button usa-button--outline no-print" modalRef={modalRef} opener>Unlock report</ModalToggleButton>
: null}
Expand All @@ -78,11 +85,15 @@ ApprovedReportSpecialButtons.propTypes = {
PropTypes.shape(),
]),
showUnlockReports: PropTypes.bool,
onCompleteEvent: PropTypes.func,
showCompleteEvent: PropTypes.bool,
};

ApprovedReportSpecialButtons.defaultProps = {
UnlockModal: <></>,
modalRef: null,
showUnlockReports: false,
user: null,
onCompleteEvent: null,
showCompleteEvent: false,
};
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { Alert } from '@trussworks/react-uswds';
import './IncompletePages.css';

const IncompletePages = ({
type,
incompletePages,
}) => (
<Alert className="smart-hub--incomplete-notice" validation noIcon slim type="error">
<b>Incomplete report</b>
<b>{`Incomplete ${type}`}</b>
<br />
This report cannot be submitted until all sections are complete.
Please review the following sections:
{`This ${type} cannot be submitted until all sections are complete.
Please review the following sections:`}
<ul>
{incompletePages.map((page) => (
<li key={page}>
Expand All @@ -23,7 +24,12 @@ const IncompletePages = ({
);

IncompletePages.propTypes = {
type: PropTypes.string,
incompletePages: PropTypes.arrayOf(PropTypes.string).isRequired,
};

IncompletePages.defaultProps = {
type: 'report',
};

export default IncompletePages;
Loading

0 comments on commit c4a60c3

Please sign in to comment.