Skip to content

Commit

Permalink
2024-11-04 - external-recips page
Browse files Browse the repository at this point in the history
  • Loading branch information
Luch76 committed Nov 4, 2024
1 parent 096eab9 commit 1b43786
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class FeedbackExternalRecipient {

@Column(name = "company_name")
@ColumnTransformer(
read = "pgp_sym_decrypt(lastName::bytea,'${aes.key}')",
read = "pgp_sym_decrypt(company_name::bytea,'${aes.key}')",
write = "pgp_sym_encrypt(?,'${aes.key}') "
)
@Schema(description = "company of the feedback external recipient")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ const StyledBox = styled(Box)({
const FeedbackExternalRecipientCard = ({
recipientProfile,
selected,
reason = null,
onClick
}) => {
const { state } = useContext(AppContext);
Expand All @@ -85,24 +84,7 @@ const FeedbackExternalRecipientCard = ({
</CheckCircleIcon>
) : null
}
subheader={
<Typography color="textSecondary" component="h3">
{recipientProfile?.title}
</Typography>
}
disableTypography
avatar={
!recipientProfile?.terminationDate ? (
<Avatar
className="large"
src={getAvatarURL(recipientProfile?.email)}
/>
) : (
<Avatar className="large">
<PriorityHighIcon />
</Avatar>
)
}
/>
<CardContent>
<Container fixed className="info-container">
Expand All @@ -115,31 +97,15 @@ const FeedbackExternalRecipientCard = ({
{recipientProfile?.email}
</a>
<br />
Location: {recipientProfile?.location}
<br />
Supervisor: {supervisorProfile?.name}
<br />
PDL: {pdlProfile?.name}
Company: {recipientProfile?.companyName}
<br />
</Typography>
{reason && (
<div className="reason">
<Divider variant="middle" className={classes.divider} />
<Typography
id="rec_reason"
name="rec_reason"
component="p"
className={classes.recommendationText}
>
{reason}
</Typography>
</div>
)}
</Container>
</CardContent>
</Card>
</StyledBox>
);

};

export default FeedbackExternalRecipientCard;
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
}
searchTextUpdated.current = true;
}
}, [searchText, profiles, fromQuery, state, userProfile, normalizedMembers]);
}
, [searchText, profiles, fromQuery, state, userProfile, normalizedMembers])
;

useEffect(() => {
function bindFromURL() {
Expand All @@ -93,20 +95,18 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
fromQuery !== undefined
) {
let profileCopy = profiles;
console.log("FeedbackExternalRecipientSelector, bindFromURL, profiles: ", profiles);
console.log("FeedbackExternalRecipientSelector, bindFromURL, fromQuery: ", fromQuery);
if (typeof fromQuery === 'string') {
let newProfile = { id: fromQuery };
if (
profiles.filter(member => member.id === newProfile.id).length === 0
) {
console.log("FeedbackExternalRecipientSelector, bindFromURL, newProfile: ", newProfile);
if (profiles.filter(member => member.id === newProfile.id).length === 0) {
profileCopy.push(newProfile);
}
} else if (Array.isArray(fromQuery)) {
for (let i = 0; i < fromQuery.length; ++i) {
let newProfile = { id: fromQuery[i] };
if (
profiles.filter(member => member.id === newProfile.id).length ===
0
) {
if (profiles.filter(member => member.id === newProfile.id).length === 0) {
profileCopy.push(newProfile);
}
}
Expand All @@ -116,7 +116,7 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
}
}

async function getSuggestions() {
async function getExternalRecipientsForSelector() {
if (forQuery === undefined || forQuery === null) {
return;
}
Expand All @@ -128,7 +128,7 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
}

if (csrf && (searchText === '' || searchText.length === 0)) {
getSuggestions().then(res => {
getExternalRecipientsForSelector().then(res => {
bindFromURL();
if (res !== undefined && res !== null) {
let filteredProfileCopy = profiles.filter(member => {
Expand All @@ -137,13 +137,17 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
});
});
let newProfiles = filteredProfileCopy.concat(res);
console.log("FeedbackExternalRecipientSelector, getExternalRecipientsForSelector, newProfiles: ", newProfiles);
setProfiles(newProfiles);
}
});
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, csrf, searchText]);
}, [id, csrf, searchText])
;

const cardClickHandler = id => {
console.log("FeedbackExternalRecipientSelector, cardClickHandler, id: ", id);
console.log("FeedbackExternalRecipientSelector, cardClickHandler, fromQuery: ", fromQuery);
if (!Array.isArray(fromQuery)) {
fromQuery = fromQuery ? [fromQuery] : [];
}
Expand Down Expand Up @@ -240,8 +244,7 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
.map(profile => (
<FeedbackExternalRecipientCard
key={profile.id}
recipientProfile={selectProfile(state, profile.id)}
reason={profile?.reason ? profile.reason : null}
recipientProfile={profile}
onClick={() => cardClickHandler(profile.id)}
/>
))}
Expand All @@ -252,6 +255,9 @@ const FeedbackExternalRecipientSelector = ({ changeQuery, fromQuery, forQuery })
</div>
</StyledGrid>
);

//recipientProfile={selectProfile(state, profile.id)}

};

FeedbackExternalRecipientSelector.propTypes = propTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,16 @@ const FeedbackRecipientSelector = ({ changeQuery, fromQuery, forQuery }) => {
});
});
let newProfiles = filteredProfileCopy.concat(res);
console.log("FeedbackRecipientSelector, getSuggestions, newProfiles: ", newProfiles);
setProfiles(newProfiles);
}
});
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, [id, csrf, searchText]);

const cardClickHandler = id => {
console.log("FeedbackRecipientSelector, cardClickHandler, id: ", id);
console.log("FeedbackRecipientSelector, cardClickHandler, fromQuery: ", fromQuery);
if (!Array.isArray(fromQuery)) {
fromQuery = fromQuery ? [fromQuery] : [];
}
Expand Down
2 changes: 2 additions & 0 deletions web-ui/src/context/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,14 @@ export const selectTerminatedMemberIds = createSelector(
export const selectProfileMap = createSelector(
selectCurrentMembers,
currentMembers => {
console.log("selectors, currentMembers 01, currentMembers: ", currentMembers);
if (currentMembers && currentMembers.length) {
currentMembers = currentMembers.reduce((mappedById, member) => {
mappedById[member.id] = member;
return mappedById;
}, {});
}
console.log("selectors, currentMembers 02, currentMembers: ", currentMembers);
return currentMembers;
}
);
Expand Down

0 comments on commit 1b43786

Please sign in to comment.