Skip to content

Commit

Permalink
VKT(Frontend): Enrollment appointment clerk interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jrkkp committed Nov 6, 2024
1 parent b3327b4 commit 0d90d81
Showing 1 changed file with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { Checkbox, FormControlLabel, FormHelperTextProps } from '@mui/material';
import { ChangeEvent, useState } from 'react';
import {
ComboBox,
CustomButton,
CustomModal,
CustomTextField,
H2,
H3,
InfoText,
Text,
valueAsOption,
} from 'shared/components';
import {
APIResponseStatus,
Color,
Severity,
TextFieldTypes,
TextFieldVariant,
Variant,
} from 'shared/enums';
import { useDialog } from 'shared/hooks';
Expand Down Expand Up @@ -69,6 +72,66 @@ const CheckboxField = ({
);
};

const GradeModal = ({
open,
skills,
closeModal,
}: {
open: boolean;
skills: PartialExamsAndSkills;
closeModal: () => void;
}) => {
const translateCommon = useCommonTranslation();
const selectedSkills = [
'writingPartialExam',
'readingComprehensionPartialExam',
'speakingPartialExam',
'speechComprehensionPartialExam',
].filter((skill: string) => skills[skill as keyof PartialExamsAndSkills]);

return (
<CustomModal
onCloseModal={closeModal}
open={open}
modalTitle={'Anna arvosanat'}
>
<>
<div style={{ width: '60vw' }} className="rows gapped-sm">
<div style={{ margin: '2em' }} className="grid-3-columns gapped">
<Text className="bold">Osakoe</Text>
<Text className="bold">Arvosana</Text>
<Text className="bold">Huomautuksia</Text>
{selectedSkills.map((skill) => (
<>
<Text>
{translateCommon(`enrollment.partialExamsAndSkills.${skill}`)}
</Text>
<ComboBox
autoHighlight
values={['1', '2', '3'].map(valueAsOption)}
variant={TextFieldVariant.Outlined}
onChange={() => skill}
value={null}
/>
<CustomTextField />
</>
))}
</div>
<div className="columns gapped flex-end">
<CustomButton
onClick={closeModal}
variant={Variant.Contained}
color={Color.Secondary}
>
{translateCommon('close')}
</CustomButton>
</div>
</div>
</>
</CustomModal>
);
};

const PaymentDetails = ({ payment }: { payment: ClerkPayment }) => {
const { t } = useClerkTranslation({
keyPrefix: 'vkt.component.clerkEnrollmentDetails',
Expand Down Expand Up @@ -251,6 +314,7 @@ export const ClerkEnrollmentAppointmentDetailsFields = ({
).paymentLink;

const [paymentLinkModalOpen, setPaymentLinkModalOpen] = useState(false);
const [gradeModalOpen, setGradeModalOpen] = useState(false);

const initialFieldErrors = Object.values(
ClerkEnrollmentAppointmentDetailsFields,
Expand Down Expand Up @@ -491,6 +555,15 @@ export const ClerkEnrollmentAppointmentDetailsFields = ({
</div>
</div>
)}
<div className="columns flex-start">
<CustomButton
onClick={setGradeModalOpen.bind(this, true)}
color={Color.Secondary}
variant={Variant.Outlined}
>
Anna arvosanat
</CustomButton>
</div>
<div className="rows gapped-sm margin-top-lg">
<H3>{t('status')}</H3>
<Text>{t(`enrollmentStatus.${enrollment.status}`)}</Text>
Expand Down Expand Up @@ -534,6 +607,11 @@ export const ClerkEnrollmentAppointmentDetailsFields = ({
<Text>Ilmoittautumislinkki: {enrollment.authLink}</Text>
</div>
</div>
<GradeModal
closeModal={setGradeModalOpen.bind(this, false)}
skills={enrollment}
open={gradeModalOpen}
/>
<CustomModal
open={paymentLinkModalOpen}
modalTitle={t('payment.modal.title')}
Expand Down

0 comments on commit 0d90d81

Please sign in to comment.