diff --git a/opentech/apply/funds/serializers.py b/opentech/apply/funds/serializers.py index ce4e4da52d58d3e2fc94e36a50971b78245adb95..8d7bd8aa6adc01612a54cb502fba066587478e04 100644 --- a/opentech/apply/funds/serializers.py +++ b/opentech/apply/funds/serializers.py @@ -142,10 +142,11 @@ class SubmissionDetailSerializer(serializers.ModelSerializer): actions = ActionSerializer(source='*') review = ReviewSummarySerializer(source='*') phase = serializers.CharField() + screening = serializers.ReadOnlyField(source='screening_status') class Meta: model = ApplicationSubmission - fields = ('id', 'title', 'stage', 'status', 'phase', 'meta_questions', 'questions', 'actions', 'review') + fields = ('id', 'title', 'stage', 'status', 'phase', 'meta_questions', 'questions', 'actions', 'review', 'screening') def serialize_questions(self, obj, fields): for field_id in fields: diff --git a/opentech/static_src/src/app/src/components/ReviewBlock/styles.scss b/opentech/static_src/src/app/src/components/ReviewBlock/styles.scss index 103cf8572df33d4625f803907edaa33f4bac1c9f..1243f9b4b98f844ca7a3261a7ec36c83432a9f08 100644 --- a/opentech/static_src/src/app/src/components/ReviewBlock/styles.scss +++ b/opentech/static_src/src/app/src/components/ReviewBlock/styles.scss @@ -1,4 +1 @@ // .reviews-sidebar styles are in apply/components/_reviews-sidebar.scss and are shared with the site -.review-block { - padding: 20px; -} diff --git a/opentech/static_src/src/app/src/components/SidebarBlock/index.js b/opentech/static_src/src/app/src/components/SidebarBlock/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1bdd1b02112cddef6063d0dc33fbd2cac8752c6a --- /dev/null +++ b/opentech/static_src/src/app/src/components/SidebarBlock/index.js @@ -0,0 +1,20 @@ +import React from 'react' +import PropTypes from 'prop-types' + +import './styles.scss'; + +export const SidebarBlock = ({ title, children }) => { + return ( + <div className="sidebar-block"> + {title && <h5>{title}</h5>} + { children } + </div> + ) +} + +SidebarBlock.propTypes = { + title: PropTypes.string, + children: PropTypes.node, +} + +export default SidebarBlock diff --git a/opentech/static_src/src/app/src/components/SidebarBlock/styles.scss b/opentech/static_src/src/app/src/components/SidebarBlock/styles.scss new file mode 100644 index 0000000000000000000000000000000000000000..04fcde87c730cbf15dc6c3c25bf5957702e1e736 --- /dev/null +++ b/opentech/static_src/src/app/src/components/SidebarBlock/styles.scss @@ -0,0 +1,3 @@ +.sidebar-block { + padding: 20px; +} diff --git a/opentech/static_src/src/app/src/containers/DisplayPanel/index.js b/opentech/static_src/src/app/src/containers/DisplayPanel/index.js index 186941b608dec34ad827a37b4472122fae3d1b57..cbf976b73e705bb44cd26555a84e2bef99826f4c 100644 --- a/opentech/static_src/src/app/src/containers/DisplayPanel/index.js +++ b/opentech/static_src/src/app/src/containers/DisplayPanel/index.js @@ -12,6 +12,7 @@ import { import CurrentSubmissionDisplay from '@containers/CurrentSubmissionDisplay' import ReviewInformation from '@containers/ReviewInformation' +import ScreeningOutcome from '@containers/ScreeningOutcome' import AddNoteForm from '@containers/AddNoteForm' import NoteListing from '@containers/NoteListing' import StatusActions from '@containers/StatusActions' @@ -59,14 +60,15 @@ const DisplayPanel = props => { const isMobile = width < 1024; let tabs = [ - <Tab button="Notes" key="note"> - <NoteListing submissionID={submissionID} /> - <AddNoteForm submissionID={submissionID} /> - </Tab>, <Tab button="Status" key="status"> + <ScreeningOutcome submissionID={submissionID} /> <StatusActions submissionID={submissionID} /> <ReviewInformation submissionID={submissionID} /> <SubmissionLink submissionID={submissionID} /> + </Tab>, + <Tab button="Notes" key="note"> + <NoteListing submissionID={submissionID} /> + <AddNoteForm submissionID={submissionID} /> </Tab> ] diff --git a/opentech/static_src/src/app/src/containers/ReviewInformation.js b/opentech/static_src/src/app/src/containers/ReviewInformation.js index 40097bce464e6df1d06e450d4d4bda8e8d5eb403..8e6a1f0d65fb2330a6eef5c3a1a3b7e31a6d0e0a 100644 --- a/opentech/static_src/src/app/src/containers/ReviewInformation.js +++ b/opentech/static_src/src/app/src/containers/ReviewInformation.js @@ -3,17 +3,19 @@ import PropTypes from 'prop-types' import { connect } from 'react-redux' import LoadingPanel from '@components/LoadingPanel' +import SidebarBlock from '@components/SidebarBlock' import ReviewBlock, { Review, AssignedToReview, Opinion } from '@components/ReviewBlock' import { getSubmissionOfID } from '@selectors/submissions' -const ReviewInformation = ({ data }) => { +const ReviewInformation = ({ submission }) => { const [showExternal, setShowExternal] = useState(false) - if (data === undefined) { + if (submission === undefined || !submission.review) { return <LoadingPanel /> } + const data = submission.review const staff = []; const nonStaff = []; @@ -79,8 +81,7 @@ const ReviewInformation = ({ data }) => { const [nonStaffReviewed, nonStaffNotReviewed] = orderPeople(nonStaff); return ( - <div className="review-block"> - <h5>Reviews & assignees</h5> + <SidebarBlock title="Reviews & assignees"> <ReviewBlock score={data.score} recommendation={data.recommendation.display}> {renderReviewBlock(staffReviewed)} {renderReviewBlock(staffNotReviewed)} @@ -93,17 +94,17 @@ const ReviewInformation = ({ data }) => { renderReviewBlock(nonStaffNotReviewed) } </ReviewBlock> - </div> + </SidebarBlock> ) } ReviewInformation.propTypes = { - data: PropTypes.object, + submission: PropTypes.object, submissionID: PropTypes.number.isRequired, } const mapStateToProps = (state, ownProps) => ({ - data: getSubmissionOfID(ownProps.submissionID)(state).review, + submission: getSubmissionOfID(ownProps.submissionID)(state), }) export default connect(mapStateToProps)(ReviewInformation) diff --git a/opentech/static_src/src/app/src/containers/ScreeningOutcome.js b/opentech/static_src/src/app/src/containers/ScreeningOutcome.js new file mode 100644 index 0000000000000000000000000000000000000000..16344e7306037d9810b84f43be8e8473df09d2de --- /dev/null +++ b/opentech/static_src/src/app/src/containers/ScreeningOutcome.js @@ -0,0 +1,24 @@ +import React from 'react' +import PropTypes from 'prop-types' +import { connect } from 'react-redux' + +import SidebarBlock from '@components/SidebarBlock' +import { getSubmissionOfID } from '@selectors/submissions' + + +const ScreeningOutcome = ({ submission }) => { + const outcome = submission && submission.screening; + return <SidebarBlock title="Screening Outcome"> + { outcome ? outcome : "Not yet screened"} + </SidebarBlock> +} + +ScreeningOutcome.propTypes = { + submission: PropTypes.object, +} + +const mapStateToProps = (state, ownProps) => ({ + submission: getSubmissionOfID(ownProps.submissionID)(state), +}) + +export default connect(mapStateToProps)(ScreeningOutcome) diff --git a/opentech/static_src/src/app/src/containers/StatusActions.js b/opentech/static_src/src/app/src/containers/StatusActions.js index ed965288ca267828da2921e398bb68ea9a406e31..61d19f6cdac1bf7514caa2bb86222fb76c6df63f 100644 --- a/opentech/static_src/src/app/src/containers/StatusActions.js +++ b/opentech/static_src/src/app/src/containers/StatusActions.js @@ -6,6 +6,7 @@ import PropTypes from 'prop-types'; import { MESSAGE_TYPES, addMessage } from '@actions/messages'; import { executeSubmissionAction } from '@actions/submissions'; import Select from '@components/Select' +import SidebarBlock from '@components/SidebarBlock' import { getSubmissionOfID } from '@selectors/submissions'; import { redirect } from '@utils'; @@ -136,7 +137,7 @@ class StatusActions extends React.Component { } return ( - <> + <SidebarBlock> <Modal isOpen={this.state.modalVisible} onRequestClose={this.closeStatusModal} contentLabel="Update status" @@ -148,7 +149,7 @@ class StatusActions extends React.Component { <div className="status-actions"> <button className="button button--primary button--full-width" onClick={this.openStatusModal}>Update status</button> </div> - </> + </SidebarBlock> ); } }