Skip to content

Commit bbbd17a

Browse files
authored
Merge pull request #102 from esc-chula/dev
Add certificate download link for students
2 parents dccbca7 + e356c30 commit bbbd17a

File tree

6 files changed

+36
-3
lines changed

6 files changed

+36
-3
lines changed

src/core/components/profile/stepCard.component.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,29 @@ const StepCard: React.FC<StepCardProps> = ({ step, status, isApproved }) => {
371371
</div>
372372
{step === 5 && application.payment.updatedAt && (
373373
<Typography variant="subtitle2" className={`${classes.text} ${classes.content}`}>
374-
Last uploaded at: {(new Date(application.payment.updatedAt)).toLocaleString()}
374+
Last uploaded at: {new Date(application.payment.updatedAt).toLocaleString()}
375375
</Typography>
376376
)}
377+
{step === 6 && application.state === "PASSED_THE_CAMP" && (
378+
<>
379+
{application.certificateDownloadLink && (
380+
<a
381+
href={`${application.certificateDownloadLink}`}
382+
target="_blank"
383+
rel="noopener noreferrer"
384+
className={`no-underline ${classes.linkButton}`}>
385+
<Button variant={"contained"} disableElevation className={`${classes.button} ${classes.solid}`} onClick={() => {}}>
386+
ดาวน์โหลดเกียรติบัตร
387+
</Button>
388+
</a>
389+
)}
390+
{!application.certificateDownloadLink && (
391+
<Typography variant="subtitle2" className={`${classes.text} ${classes.content}`} style={{ fontWeight: 500, color: "#941014" }}>
392+
ขอแสดงความเสียใจ น้องไม่ได้รับเกียรติบัตรในการเข้าร่วมค่ายลานเกียร์ครั้งนี้
393+
</Typography>
394+
)}
395+
</>
396+
)}
377397
</>
378398
)}
379399
</div>

src/core/components/profile/stepCardList.component.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ const StepCardList: React.FC<StepCardListProps> = ({ status, lgCode, firstname,
8686
props[5] = { step: 5, status: "complete", isApproved: "true" }
8787
props[6] = { step: 6, status: "inProgress", isApproved: "true" }
8888
break
89+
case ProfileStatus.passedTheCamp:
90+
props[1] = { step: 1, status: "complete", isApproved: "true" }
91+
props[2] = { step: 2, status: "complete", isApproved: "true" }
92+
props[3] = { step: 3, status: "complete", isApproved: "true" }
93+
props[4] = { step: 4, status: "complete", isApproved: "true" }
94+
props[5] = { step: 5, status: "complete", isApproved: "true" }
95+
props[6] = { step: 6, status: "complete", isApproved: "true" }
96+
break
8997
case ProfileStatus.paymentFailed:
9098
props[1] = { step: 1, status: "complete", isApproved: "true" }
9199
props[2] = { step: 2, status: "complete", isApproved: "true" }

src/core/models/dto/application.dto.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export type ApplicationState =
1414
| "REJECTED_FAILED_THE_INTERVIEW"
1515
| "PAYMENT_ACCEPTED"
1616
| "REJECTED_FAIL_TO_PAY"
17+
| "PASSED_THE_CAMP"
1718

1819
export type FileStatus = "EMPTY" | "UPLOADED" | "CHANGE_REQUIRED" | "PASSED"
1920

src/core/models/dto/profile.dto.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ interface ProfileDTO {
5252
interviewAvailability: string
5353
unavailableReason: string | null
5454
interviewRoom?: string
55+
certificatePreviewLink?: string
56+
certificateDownloadLink?: string
5557
}
5658

5759
export default ProfileDTO

src/core/models/profileStatus.model.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@ export enum ProfileStatus {
1010
passedInterview = "passedInterview",
1111
failedInterview = "failedInterview",
1212
paymentAccepted = "paymentAccepted",
13-
paymentFailed = "paymentFailed"
13+
paymentFailed = "paymentFailed",
14+
passedTheCamp = "passedTheCamp"
1415
}

src/modules/profile.module.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ const ProfileModule = () => {
6565
PASSED_INTERVIEW: ProfileStatus.passedInterview,
6666
REJECTED_FAILED_THE_INTERVIEW: ProfileStatus.failedInterview,
6767
PAYMENT_ACCEPTED: ProfileStatus.paymentAccepted,
68-
REJECTED_FAIL_TO_PAY: ProfileStatus.paymentFailed
68+
REJECTED_FAIL_TO_PAY: ProfileStatus.paymentFailed,
69+
PASSED_THE_CAMP: ProfileStatus.passedTheCamp
6970
}
7071

7172
const profileStatus = applicationState === "SUBMITTED" ? profileStatusMap[applicationState][fileStatus] : profileStatusMap[applicationState]

0 commit comments

Comments
 (0)