diff --git a/backend/vkt/src/main/resources/application-dev.yaml b/backend/vkt/src/main/resources/application-dev.yaml index c9630b4e9..cb2b990d6 100644 --- a/backend/vkt/src/main/resources/application-dev.yaml +++ b/backend/vkt/src/main/resources/application-dev.yaml @@ -5,7 +5,7 @@ server: secure: false app: reservation: - duration: PT5M + duration: PT50M payment: paytrail: secret: SAIPPUAKAUPPIAS diff --git a/frontend/packages/shared/package.json b/frontend/packages/shared/package.json index ea872fd27..a2a8b5290 100644 --- a/frontend/packages/shared/package.json +++ b/frontend/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@opetushallitus/kieli-ja-kaantajatutkinnot.shared", - "version": "1.10.6", + "version": "1.10.7", "description": "Shared Frontend Package", "exports": { "./components": "./src/components/index.tsx", diff --git a/frontend/packages/shared/src/styles/abstracts/common/_layout.scss b/frontend/packages/shared/src/styles/abstracts/common/_layout.scss index 39e2c4968..41352e196 100644 --- a/frontend/packages/shared/src/styles/abstracts/common/_layout.scss +++ b/frontend/packages/shared/src/styles/abstracts/common/_layout.scss @@ -74,6 +74,15 @@ } } +.grid-3-columns { + display: grid; + grid-template-columns: repeat(3, minmax(5rem, calc(33% - 1rem))); + + @include phone { + grid-template-columns: auto; + } +} + /* TABLE */ .table-layout-auto { &#{&} { diff --git a/frontend/packages/vkt/package.json b/frontend/packages/vkt/package.json index d21d5afdd..022a3ef06 100644 --- a/frontend/packages/vkt/package.json +++ b/frontend/packages/vkt/package.json @@ -26,6 +26,6 @@ }, "dependencies": { "reduxjs-toolkit-persist": "^7.2.1", - "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" + "shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.7" } } diff --git a/frontend/packages/vkt/src/components/clerkExamEvent/overview/ClerkExamEventDetails.tsx b/frontend/packages/vkt/src/components/clerkExamEvent/overview/ClerkExamEventDetails.tsx index e0d5b84d0..7c5417700 100644 --- a/frontend/packages/vkt/src/components/clerkExamEvent/overview/ClerkExamEventDetails.tsx +++ b/frontend/packages/vkt/src/components/clerkExamEvent/overview/ClerkExamEventDetails.tsx @@ -316,6 +316,11 @@ export const ClerkExamEventDetails = () => { status={EnrollmentStatus.PAID} examEventId={examEventDetails.id} /> + { if (submitStatus === APIResponseStatus.Success) { - if (enrollment.status != EnrollmentStatus.QUEUED) { + if (EnrollmentUtils.isPaymentRequired(enrollment)) { // Safari needs time to re-render loading indicator setTimeout(() => { window.location.href = RouteUtils.getPaymentCreateApiRoute( @@ -124,14 +124,7 @@ export const PublicEnrollmentControlButtons = ({ ); } } - }, [ - submitStatus, - navigate, - dispatch, - examEventId, - enrollment.id, - enrollment.status, - ]); + }, [submitStatus, navigate, dispatch, examEventId, enrollment]); const handleBackBtnClick = () => { const nextStep: PublicEnrollmentFormStep = activeStep - 1; diff --git a/frontend/packages/vkt/src/components/publicEnrollment/steps/Preview.tsx b/frontend/packages/vkt/src/components/publicEnrollment/steps/Preview.tsx index ba44ab06a..fd139341c 100644 --- a/frontend/packages/vkt/src/components/publicEnrollment/steps/Preview.tsx +++ b/frontend/packages/vkt/src/components/publicEnrollment/steps/Preview.tsx @@ -56,38 +56,52 @@ const ExamEventDetails = ({ enrollment }: { enrollment: PublicEnrollment }) => { }); const translateCommon = useCommonTranslation(); - const translateIfSelected = (skill: keyof PartialExamsAndSkills) => { - return enrollment[skill] - ? translateCommon(`enrollment.partialExamsAndSkills.${skill}`) - : undefined; - }; - - const skills = [ - translateIfSelected('textualSkill'), - translateIfSelected('oralSkill'), - translateIfSelected('understandingSkill'), - ].filter((s) => !!s); + const skills = ['textualSkill', 'oralSkill', 'understandingSkill'].filter( + (skill) => !!enrollment[skill as keyof PartialExamsAndSkills], + ); const partialExams = [ - translateIfSelected('writingPartialExam'), - translateIfSelected('readingComprehensionPartialExam'), - translateIfSelected('speakingPartialExam'), - translateIfSelected('speechComprehensionPartialExam'), - ].filter((s) => !!s); + 'writingPartialExam', + 'readingComprehensionPartialExam', + 'speakingPartialExam', + 'speechComprehensionPartialExam', + ].filter((exam) => !!enrollment[exam as keyof PartialExamsAndSkills]); + + const displaySkillsList = () => ( +
+
+ {t('selectedPartialExamsLabel')} + Ilmaisia kertoja + Hinta +
+ {skills.map((skill, i) => ( +
+ + {translateCommon(`enrollment.partialExamsAndSkills.${skill}`)} + + {skill != 'understandingSkill' && ( + <> + 3/3 + 0€ + + )} +
+ ))} +
+ ); - const displayBulletList = ( - label: string, - items: Array, - ) => ( + const displayExamsList = () => (
- {label} + {t('selectedSkillsLabel')} {':'}
    - {items.map((item, i) => ( + {partialExams.map((skill, i) => ( -
  • {item}
  • +
  • + {translateCommon(`enrollment.partialExamsAndSkills.${skill}`)} +
  • ))}
@@ -97,8 +111,8 @@ const ExamEventDetails = ({ enrollment }: { enrollment: PublicEnrollment }) => { return (

{t('title')}

- {displayBulletList(t('selectedSkillsLabel'), skills)} - {displayBulletList(t('selectedPartialExamsLabel'), partialExams)} + {displaySkillsList()} + {displayExamsList()}
{t('previousEnrollmentLabel')} diff --git a/frontend/packages/vkt/src/enums/app.ts b/frontend/packages/vkt/src/enums/app.ts index 9e2bb52af..550bbe5e2 100644 --- a/frontend/packages/vkt/src/enums/app.ts +++ b/frontend/packages/vkt/src/enums/app.ts @@ -49,7 +49,9 @@ export enum UIMode { } export enum EnrollmentStatus { + COMPLETED = 'COMPLETED', PAID = 'PAID', + AWAITING_APPROVAL = 'AWAITING_APPROVAL', SHIFTED_FROM_QUEUE = 'SHIFTED_FROM_QUEUE', EXPECTING_PAYMENT_UNFINISHED_ENROLLMENT = 'EXPECTING_PAYMENT_UNFINISHED_ENROLLMENT', QUEUED = 'QUEUED', diff --git a/frontend/packages/vkt/src/interfaces/publicEducation.ts b/frontend/packages/vkt/src/interfaces/publicEducation.ts new file mode 100644 index 000000000..8bbbe5b04 --- /dev/null +++ b/frontend/packages/vkt/src/interfaces/publicEducation.ts @@ -0,0 +1,15 @@ +interface Education { + allowsFreeEnrollment: boolean; + name: string; + ongoing: boolean; +} + +interface FreeEnrollments { + textualSkill: 0 | 1 | 2 | 3; + oralSkill: 0 | 1 | 2 | 3; +} + +export interface PublicEducationDetails { + educationHistory: Education[]; + freeEnrollments: FreeEnrollments; +} diff --git a/frontend/packages/vkt/src/interfaces/publicEnrollment.ts b/frontend/packages/vkt/src/interfaces/publicEnrollment.ts index 9abeffc8a..163733a7d 100644 --- a/frontend/packages/vkt/src/interfaces/publicEnrollment.ts +++ b/frontend/packages/vkt/src/interfaces/publicEnrollment.ts @@ -5,6 +5,7 @@ import { CertificateShippingData, PartialExamsAndSkills, } from 'interfaces/common/enrollment'; +import { PublicEducationDetails } from 'interfaces/publicEducation'; import { PublicExamEventResponse } from 'interfaces/publicExamEvent'; import { PublicPerson } from 'interfaces/publicPerson'; import { WithId } from 'interfaces/with'; @@ -48,6 +49,7 @@ export interface PublicEnrollment examEventId?: number; hasPaymentLink?: boolean; isFree?: boolean; + education?: PublicEducationDetails; } export interface PublicEnrollmentResponse diff --git a/frontend/packages/vkt/src/utils/enrollment.ts b/frontend/packages/vkt/src/utils/enrollment.ts index 2e1863254..d21ebef5e 100644 --- a/frontend/packages/vkt/src/utils/enrollment.ts +++ b/frontend/packages/vkt/src/utils/enrollment.ts @@ -1,5 +1,6 @@ import { StringUtils } from 'shared/utils'; +import { EnrollmentStatus } from 'enums/app'; import { CertificateShippingData, PartialExamsAndSkills, @@ -45,6 +46,14 @@ export class EnrollmentUtils { ); } + static isPaymentRequired(enrollment: PublicEnrollment) { + return ( + enrollment.status == EnrollmentStatus.SHIFTED_FROM_QUEUE || + enrollment.status == + EnrollmentStatus.EXPECTING_PAYMENT_UNFINISHED_ENROLLMENT + ); + } + static isValidCertificateShipping(shippingData: CertificateShippingData) { const isAddressFieldsFilled = [ shippingData.street, diff --git a/frontend/yarn.lock b/frontend/yarn.lock index dc2f9b4a3..cdc9342b9 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -2687,7 +2687,7 @@ __metadata: languageName: unknown linkType: soft -"@opetushallitus/kieli-ja-kaantajatutkinnot.shared@workspace:packages/shared, shared@npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.6": +"@opetushallitus/kieli-ja-kaantajatutkinnot.shared@workspace:packages/shared, shared@npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.7": version: 0.0.0-use.local resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.shared@workspace:packages/shared" languageName: unknown @@ -2698,7 +2698,7 @@ __metadata: resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.vkt@workspace:packages/vkt" dependencies: reduxjs-toolkit-persist: "npm:^7.2.1" - shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.5" + shared: "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.7" languageName: unknown linkType: soft @@ -11789,6 +11789,13 @@ __metadata: languageName: node linkType: hard +"shared@npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.6": + version: 1.10.6 + resolution: "@opetushallitus/kieli-ja-kaantajatutkinnot.shared@npm:1.10.6::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40Opetushallitus%2Fkieli-ja-kaantajatutkinnot.shared%2F1.10.6%2F138bc1d046232b00fa0483033d1827141dfe7171" + checksum: 6f58ec1109ff04e01765995be46f88e64d419335f5aa67e39bcc710e01fe286ef760385ed49eba05322ab72860cd47ec6917bae66a801953a573c5bbed9230ce + languageName: node + linkType: hard + "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0"