-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from adhocteam/js-137-manager-approves-report
Managers can add notes and set status of reports
- Loading branch information
Showing
35 changed files
with
538 additions
and
104 deletions.
There are no files selected for viewing
This file contains 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 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,46 @@ | ||
put: | ||
tags: | ||
- activity-reports | ||
summary: Review an activity report | ||
description: > | ||
An approving manager reviews an activity report to determine if it requires | ||
any additional updates. If the report needs updates the manager sets the status to | ||
'Needs Action', otherwise to 'Approved' | ||
requestBody: | ||
description: The status and any manager notes | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
status: | ||
type: string | ||
description: The status of the report after review | ||
enum: | ||
- Approved | ||
- Needs Action | ||
managerNotes: | ||
type: string | ||
description: Any notes the manager needs to relay to the author/collaborators of the report | ||
parameters: | ||
- in: path | ||
name: activityReportId | ||
required: true | ||
schema: | ||
type: number | ||
responses: | ||
200: | ||
description: The new status of the activity report | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
status: | ||
type: string | ||
enum: | ||
- Approved | ||
- Needs Action | ||
managerNotes: | ||
type: string |
This file contains 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 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 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 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 |
---|---|---|
|
@@ -64,3 +64,5 @@ export const REGIONS = [ | |
11, | ||
12, | ||
]; | ||
|
||
export const DECIMAL_BASE = 10; |
This file contains 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 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 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 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 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 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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import join from 'url-join'; | ||
import { get, put } from './index'; | ||
import { DECIMAL_BASE } from '../Constants'; | ||
|
||
export const getUsers = async () => { | ||
const users = await get((join('/', 'api', 'admin', 'users'))); | ||
return users.json(); | ||
}; | ||
|
||
export const updateUser = async (userId, data) => { | ||
const user = await put((join('/', 'api', 'admin', 'users', userId.toString(10))), data); | ||
const user = await put((join('/', 'api', 'admin', 'users', userId.toString(DECIMAL_BASE))), data); | ||
return user.json(); | ||
}; |
This file contains 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
64 changes: 64 additions & 0 deletions
64
frontend/src/pages/ActivityReport/Pages/ApproverReviewPage.js
This file contains 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,64 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { | ||
Dropdown, Form, Label, Fieldset, Textarea, Alert, Button, | ||
} from '@trussworks/react-uswds'; | ||
|
||
const possibleStatus = [ | ||
'Approved', | ||
'Needs Action', | ||
]; | ||
|
||
const ApproverReviewPage = ({ | ||
reviewed, | ||
additionalNotes, | ||
register, | ||
valid, | ||
handleSubmit, | ||
onFormReview, | ||
}) => ( | ||
<> | ||
{reviewed | ||
&& ( | ||
<Alert noIcon className="margin-y-4" type="success"> | ||
<b>Success</b> | ||
<br /> | ||
Your review of this report was successfully submitted | ||
</Alert> | ||
)} | ||
<h2>Review and approve report</h2> | ||
<div className="smart-hub--creator-notes"> | ||
<p> | ||
<span className="text-bold">Creator notes</span> | ||
<br /> | ||
<br /> | ||
{ additionalNotes || 'No creator notes' } | ||
</p> | ||
</div> | ||
<Form className="smart-hub--form-large" onSubmit={handleSubmit(onFormReview)}> | ||
<Fieldset className="smart-hub--report-legend smart-hub--form-section" legend="Review and submit report"> | ||
<Label htmlFor="managerNotes">Manager notes</Label> | ||
<Textarea inputRef={register} id="managerNotes" name="managerNotes" /> | ||
</Fieldset> | ||
<Label htmlFor="status">Choose report status</Label> | ||
<Dropdown id="status" name="status" defaultValue="" inputRef={register({ required: true })}> | ||
<option name="default" value="" disabled hidden>- Select -</option> | ||
{possibleStatus.map((status) => ( | ||
<option key={status} value={status}>{status}</option> | ||
))} | ||
</Dropdown> | ||
<Button type="submit" disabled={!valid}>Submit</Button> | ||
</Form> | ||
</> | ||
); | ||
|
||
ApproverReviewPage.propTypes = { | ||
reviewed: PropTypes.bool.isRequired, | ||
additionalNotes: PropTypes.string.isRequired, | ||
register: PropTypes.func.isRequired, | ||
valid: PropTypes.bool.isRequired, | ||
handleSubmit: PropTypes.func.isRequired, | ||
onFormReview: PropTypes.func.isRequired, | ||
}; | ||
|
||
export default ApproverReviewPage; |
This file contains 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,8 @@ | ||
.smart-hub--creator-notes { | ||
padding: 1rem; | ||
background-color: #f8f8f8; | ||
} | ||
|
||
#status { | ||
max-width: 270px; | ||
} |
Oops, something went wrong.