Skip to content

Commit

Permalink
coordinator should be able to update the feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
USER USER committed Dec 18, 2023
1 parent 4e5fc78 commit 5bb0935
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 27 deletions.
9 changes: 7 additions & 2 deletions src/Mutations/Ratings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const FETCH_ALL_RATINGS = gql`
user {
id
email
profile{
profile {
firstName
lastName
}
Expand Down Expand Up @@ -204,6 +204,7 @@ export const UPDATE_RATING = gql`
$qualityRemark: [String]
$professionalSkills: [String]
$professionalRemark: [String]
$feedbacks: [String]
$orgToken: String!
) {
updateRating(
Expand All @@ -215,6 +216,7 @@ export const UPDATE_RATING = gql`
qualityRemark: $qualityRemark
professional_Skills: $professionalSkills
professionalRemark: $professionalRemark
feedbacks: $feedbacks
orgToken: $orgToken
) {
user
Expand All @@ -225,6 +227,9 @@ export const UPDATE_RATING = gql`
qualityRemark
professional_Skills
professionalRemark
feedbacks {
content
}
}
}
`;
Expand Down Expand Up @@ -407,4 +412,4 @@ export const GET_ALL_TRAINEES = gql`
}
}
}
`;
`;
18 changes: 11 additions & 7 deletions src/components/ratings/ViewWeeklyRatings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function ViewSprintRatings({
const [updateMessage, setUpdateMessage] = useState('');
const [defaultGrading, setDefaultGrading] = useState<any[]>([]);
const [loggedUserRole, setloggedUser] = useState(null);
const [loggedUserId, setloggedUserId] = useState(null);

const [showActions, setShowActions] = useState(false);
const navigate = useNavigate();
Expand Down Expand Up @@ -65,15 +66,19 @@ function ViewSprintRatings({

if (storedAuth) {
const auth = JSON.parse(storedAuth);
const { role } = auth;
const { role, userId } = auth;

if (role) {
setloggedUser(role);
}
if (userId) {
setloggedUserId(userId);
}
}
}, []);

const [DefaultGrade] = useLazyQuery(DEFAULT_GRADE, {});
const [updateRatings, { loading: updateRatingLoading, data, error }] =
const [updateRatings, { loading: updateRatingLoading }] =
useMutation(UPDATE_RATING);

const openEditRatingForm = () => {
Expand All @@ -90,7 +95,7 @@ function ViewSprintRatings({
qualityremark: '',
quantity: ratingChosen.quantity,
quantityremark: '',
feedback: '',
feedbacks: ratingChosen.feedbacks[0].content,
professional: ratingChosen.professional_Skills,
professionalRemark: '',
bodyQuantity: '',
Expand All @@ -103,7 +108,6 @@ function ViewSprintRatings({
});
}
}, [editRatingFormVisible]);

useEffect(() => {
if (updateMessage) {
const time = setTimeout(() => {
Expand All @@ -125,6 +129,7 @@ function ViewSprintRatings({
qualityRemark: rows?.qualityremark,
professionalSkills: rows?.professional,
professionalRemark: rows?.professionalRemark,
feedbacks: rows?.feedbacks,
orgToken: organizationToken,
};
await updateRatings({ variables: { ...ratingsData } });
Expand Down Expand Up @@ -446,15 +451,14 @@ function ViewSprintRatings({
<h1 className="pb-3 font-medium">{t('Feedback')}</h1>
<textarea
name="Feedback"
value={rows.professionalRemark}
value={rows.feedbacks}
onChange={(e) =>
setRows({
...rows,
professionalRemark: e.target.value,
feedbacks: e.target.value,
})
}
className="h-32 w-full dark:bg-[#6F6F6F] rounded-xl px-3 py-2"
placeholder="Feedback in general about performance"
/>

<div className="mt-4 md:mt-8 flex justify-end">
Expand Down
19 changes: 6 additions & 13 deletions src/containers/admin-dashBoard/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import UpdateTeamModal from './UpdateTeamModal';
import TeamTraineeModal from './TeamTraineeModal';
import CreateTeamModal from './CreateTeamModal';


export interface Cohort {
id: string;
name: string;
Expand Down Expand Up @@ -50,7 +49,6 @@ export const getAllTeam = gql`
lastName
}
email
}
phase {
name
Expand All @@ -74,7 +72,6 @@ export const getAllTeam = gql`
quality
professional_Skills
}
}
getAllCohorts(orgToken: $orgToken) {
Expand Down Expand Up @@ -144,7 +141,6 @@ function ActionButtons({
cursor="pointer"
color="#9e85f5"
/>

</div>
<div
data-testid="deleteIcon"
Expand Down Expand Up @@ -191,12 +187,12 @@ function AdminTeams() {
const [createTeamModal, setCreateTeamModal] = useState(false);
const [updateTeamModal, setUpdateTeamModal] = useState(false);
const [teamTrainneModal, setTeamTrainneModal] = useState(false);

const [currentTeam, setCurrentTeam] = useState<Team | undefined>(undefined);

const [deleteTeamModal, setDeleteTeamModal] = useState(false);
useDocumentTitle('Teams');

const removeDeleteModel = () => {
const newState = !deleteTeamModal;
setDeleteTeamModal(newState);
Expand Down Expand Up @@ -228,7 +224,6 @@ function AdminTeams() {
}),
},
];


const teamData = getData?.getAllTeams.map(({ name, cohort, ttl }) => ({
name,
Expand All @@ -244,7 +239,7 @@ function AdminTeams() {
return (
<>
{/* =========================== Start:: CreateCohortModel =============================== */}

<CreateTeamModal
data={getData}
createTeamModel={createTeamModal}
Expand All @@ -269,8 +264,7 @@ function AdminTeams() {
setTeamTrainneModal(false);
}}
/>



<DeleteTeamModal
deleteTeamModal={deleteTeamModal}
currentTeam={currentTeam}
Expand Down Expand Up @@ -303,8 +297,7 @@ function AdminTeams() {
loading={getLoading}
/>
</div>
</div>

</div>
</>
);
}
Expand Down
11 changes: 6 additions & 5 deletions src/pages/UpdatedRatingDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ function UpdatedRatingDashboard() {
{ Header: `${t('Quantity')}`, accessor: 'quantity' },
{ Header: `${t('Quality')}`, accessor: 'quality' },
{ Header: `${t('Professional skills')}`, accessor: 'professional_Skills' },
{ Header: `${t('Feedback')}`, accessor: 'feedback' },
{
Header: `${t('Actions')}`,
accessor: '',
Expand Down Expand Up @@ -107,7 +108,7 @@ function UpdatedRatingDashboard() {
id: row.original.user.id,
sprint: row.original.sprint,
});
/* istanbul ignore next */
/* istanbul ignore next */
setRejectModel(!rejectModel);
}}
>
Expand Down Expand Up @@ -170,7 +171,7 @@ function UpdatedRatingDashboard() {
toast.success('Successfully rejected!');
/* istanbul ignore next */
removeRejectModel();
/* istanbul ignore next */
/* istanbul ignore next */
handleToggle();
},
});
Expand Down Expand Up @@ -212,7 +213,7 @@ function UpdatedRatingDashboard() {
</div>
<div className="w-full flex justify-between">
<Button
/* istanbul ignore next */
/* istanbul ignore next */
data-testid="removeApproveModel"
variant="info"
size="sm"
Expand All @@ -229,7 +230,7 @@ function UpdatedRatingDashboard() {
<Button
variant="primary"
size="sm"
/* istanbul ignore next */
/* istanbul ignore next */
style="w-[30%] md:w-1/4 text-sm font-sans"
onClick={() => approveRating()}
>
Expand Down Expand Up @@ -275,7 +276,7 @@ function UpdatedRatingDashboard() {
<Button
variant="danger"
size="sm"
/* istanbul ignore next */
/* istanbul ignore next */
style="w-[30%] md:w-1/4 text-sm font-sans"
/* istanbul ignore next */
onClick={() => rejectRating()}
Expand Down

0 comments on commit 5bb0935

Please sign in to comment.