Skip to content

Commit ad7b9e4

Browse files
committed
2024-10-30 - feedback - external reviewer - server-side
1 parent f4888f3 commit ad7b9e4

File tree

7 files changed

+75
-44
lines changed

7 files changed

+75
-44
lines changed

server/src/main/java/com/objectcomputing/checkins/services/feedback_template/FeedbackTemplateController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public List<FeedbackTemplateResponseDTO> findByValues(@Nullable UUID creatorId,
116116
* @return {@link FeedbackTemplate}
117117
*/
118118
private FeedbackTemplate fromDTO(FeedbackTemplateCreateDTO dto) {
119-
return new FeedbackTemplate(dto.getTitle(), dto.getDescription(), dto.getCreatorId(), dto.getIsPublic(), dto.getIsAdHoc(), dto.getIsReview());
119+
return new FeedbackTemplate(dto.getTitle(), dto.getDescription(), dto.getCreatorId(), dto.getIsPublic(), dto.getIsAdHoc(), dto.getIsReview(), dto.getIsForExternalRecipient());
120120
}
121121

122122
/**

server/src/main/resources/db/dev/R__Load_testing_data.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@ VALUES
12501250
INSERT INTO feedback_templates
12511251
(id, title, description, creator_id, date_created, active, is_public, is_ad_hoc, is_for_external_recipient) -- created by: Big Boss
12521252
VALUES
1253-
('265c4d57-7cd9-4c14-9878-bd05d3bb59f1', 'Survey 1', 'Make a survey with a few questions for external recipients'
1253+
('265c4d57-7cd9-4c14-9878-bd05d3bb59f1', 'Survey For External Recips', 'Make a survey with a few questions for external recipients'
12541254
, '72655c4f-1fb8-4514-b31e-7f7e19fa9bd7', '2021-05-05', true, true, false, true)
12551255
;
12561256
INSERT INTO template_questions

web-ui/src/components/feedback_template_selector/FeedbackTemplateSelector.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
9898
isAdHoc: true,
9999
isPublic: false,
100100
isReview: false,
101+
isForExternalRecipient: submittedTemplate.isForExternalRecipient,
101102
};
102103

103104
const newTemplateQuestion = {
@@ -189,6 +190,7 @@ const FeedbackTemplateSelector = ({ query, changeQuery }) => {
189190
isAdHoc={template.isAdHoc}
190191
isPublic={template.isPublic}
191192
isReview={template.isReview}
193+
isForExternalRecipient={template.isForExternalRecipient}
192194
isSelected={query === template.id}
193195
questions={template.questions}
194196
expanded={preview.open}

web-ui/src/components/template-card/TemplateCard.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.feedback-template-card {
22
cursor: pointer;
33
width: 300px;
4-
max-height: 300px;
4+
max-height: 350px;
55
padding: 15px;
66
margin: 20px;
77
box-shadow: #282c34;
@@ -24,7 +24,7 @@
2424
text-align: center;
2525
padding-bottom: 0;
2626
margin-bottom: 0;
27-
max-height: 200px;
27+
max-height: 250px;
2828
}
2929

3030
.feedback-template-card .template-name {
@@ -44,6 +44,11 @@
4444
margin: 0;
4545
}
4646

47+
.feedback-template-card .externalRecipient {
48+
text-align: left;
49+
margin: 0;
50+
}
51+
4752
@media (min-width: 321px) and (max-width: 820px) {
4853
.feedback-template-card {
4954
width: 100%;

web-ui/src/components/template-card/TemplateCard.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ const TemplateCard = props => {
111111
<p className="creator">
112112
Created by: <b>{creatorName}</b>
113113
</p>
114+
{props.isForExternalRecipient && (
115+
<label className="externalRecipientLabel" style={{ display: 'flex', alignItems: 'center' }}>
116+
<input
117+
type="checkbox"
118+
checked={props.isForExternalRecipient}
119+
disabled
120+
className="externalRecipient"
121+
/>
122+
<span style={{ marginLeft: '5px' }}>For external recipients only</span>
123+
</label>
124+
)}
114125
</CardContent>
115126
</Card>
116127
);

web-ui/src/components/template-preview-modal/TemplatePreviewModal.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const TemplatePreviewModal = ({
114114
submittedTemplate.title = newAdHocData.title;
115115
submittedTemplate.description = newAdHocData.description;
116116
submittedQuestion = newAdHocData.question;
117+
submittedTemplate.isForExternalRecipient = newAdHocData.isForExternalRecipient;
117118
}
118119
onSubmit(submittedTemplate, submittedQuestion);
119120
};

web-ui/src/components/template-preview-modal/ad_hoc_creation_form/AdHocCreationForm.jsx

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,65 @@ const propTypes = {
88
const AdHocCreationForm = props => {
99
const [title, setTitle] = useState('Ad Hoc');
1010
const [description, setDescription] = useState('');
11+
const [isForExternalRecipient, setIsForExternalRecipient] = useState(false);
1112
const [question, setQuestion] = useState('');
1213

1314
useEffect(() => {
1415
props.onFormChange({
15-
title: title,
16-
description: description,
17-
question: question
16+
title: title
17+
, description: description
18+
, question: question
19+
, isForExternalRecipient: isForExternalRecipient
1820
}); // eslint-disable-next-line
19-
}, [title, description, question]);
21+
}, [title, description, question, isForExternalRecipient]);
2022

2123
return (
22-
<React.Fragment>
23-
<TextField
24-
label="Title"
25-
placeholder="Ad Hoc"
26-
fullWidth
27-
margin="normal"
28-
required={true}
29-
value={title}
30-
onChange={event => {
31-
setTitle(event.target.value);
32-
}}
33-
/>
34-
<TextField
35-
label="Description"
36-
placeholder="Give a brief description of the template (optional)"
37-
fullWidth
38-
margin="normal"
39-
value={description}
40-
onChange={event => {
41-
setDescription(event.target.value);
42-
}}
43-
/>
44-
<TextField
45-
label="Ask a feedback question"
46-
placeholder="How is your day going?"
47-
fullWidth
48-
multiline
49-
maxRows={10}
50-
margin="normal"
51-
required={true}
52-
value={question}
53-
onChange={event => {
54-
setQuestion(event.target.value);
55-
}}
56-
/>
57-
</React.Fragment>
24+
<React.Fragment>
25+
<TextField
26+
label="Title"
27+
placeholder="Ad Hoc"
28+
fullWidth
29+
margin="normal"
30+
required={true}
31+
value={title}
32+
onChange={event => {
33+
setTitle(event.target.value);
34+
}}
35+
/>
36+
<TextField
37+
label="Description"
38+
placeholder="Give a brief description of the template (optional)"
39+
fullWidth
40+
margin="normal"
41+
value={description}
42+
onChange={event => {
43+
setDescription(event.target.value);
44+
}}
45+
/>
46+
<label style={{display: 'flex', alignItems: 'center'}}>
47+
<input
48+
type="checkbox"
49+
checked={isForExternalRecipient}
50+
onChange={event => {
51+
setIsForExternalRecipient(event.target.checked);
52+
}}
53+
/>
54+
<span style={{marginLeft: '5px'}}>For external recipients only</span>
55+
</label>
56+
<TextField
57+
label="Ask a feedback question"
58+
placeholder="How is your day going?"
59+
fullWidth
60+
multiline
61+
maxRows={10}
62+
margin="normal"
63+
required={true}
64+
value={question}
65+
onChange={event => {
66+
setQuestion(event.target.value);
67+
}}
68+
/>
69+
</React.Fragment>
5870
);
5971
};
6072

0 commit comments

Comments
 (0)