Skip to content

Commit

Permalink
admin can now view documents uploaded by doctor
Browse files Browse the repository at this point in the history
  • Loading branch information
NairuzY committed Nov 14, 2023
1 parent e6e1c0b commit 82085b5
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
5 changes: 5 additions & 0 deletions backend/src/app/controllers/doctor.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ doctorsRouter.get(
educationalBackground: doctor.educationalBackground,
speciality: doctor.speciality,
requestStatus: doctor.requestStatus as DoctorStatus,
documents: doctor.documents as [string],
})),
} satisfies GetPendingDoctorsResponse)
})
Expand Down Expand Up @@ -144,6 +145,7 @@ doctorsRouter.get(
availableTimes: doctor.availableTimes as [Date],
requestStatus: doctor.requestStatus as DoctorStatus,
hasDiscount: hasDiscountOnDoctorSession({ patient }),
documents: doctor.documents as [string],
})),
} satisfies GetApprovedDoctorsResponse)
})
Expand All @@ -169,6 +171,7 @@ doctorsRouter.get(
availableTimes: doctor.availableTimes as [Date],
contractStatus: doctor.contractStatus as ContractStatus,
employmentContract: doctor.employmentContract as [string],
documents: doctor.documents as [string],
} satisfies GetDoctorResponse)
})
)
Expand Down Expand Up @@ -268,6 +271,7 @@ doctorsRouter.patch(
availableTimes: doctor.availableTimes as [Date],
contractStatus: doctor.contractStatus as ContractStatus,
employmentContract: doctor.employmentContract as [string],
documents: doctor.documents as [string],
} satisfies AcceptOrRejectContractResponse)
})
)
Expand All @@ -291,6 +295,7 @@ doctorsRouter.patch(
availableTimes: doctor.availableTimes as [Date],
contractStatus: doctor.contractStatus as ContractStatus,
employmentContract: doctor.employmentContract as [string],
documents: doctor.documents as [string],
} satisfies AcceptOrRejectContractResponse)
})
)
Expand Down
2 changes: 2 additions & 0 deletions clinic-common/types/doctor.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface AcceptOrRejectContractResponse extends DoctorResponseBase {
contractStatus: ContractStatus
availableTimes: [Date]
employmentContract: [string]
documents: [string]
}

export interface ApproveDoctorResponse extends DoctorResponseBase {
Expand All @@ -56,6 +57,7 @@ export interface GetDoctorResponse extends DoctorResponseBase {
contractStatus: ContractStatus
availableTimes: [Date]
employmentContract: [string]
documents: [string]
}

export interface GetApprovedDoctorsResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,32 @@ export function PendingDoctorDetails() {
}

return (
<DetailsCard
fields={[
{ label: 'Name', value: query.data?.name },
{ label: 'Username', value: query.data?.username },
{ label: 'Email', value: query.data?.email },
{ label: 'Affiliation', value: query.data?.affiliation },
{ label: 'Specialization', value: query.data?.speciality },
{
label: 'Educational Background',
value: query.data?.educationalBackground,
},
{
label: 'Date of Birth',
value:
query.data && new Date(query.data.dateOfBirth).toLocaleDateString(),
},
{ label: 'Specialization', value: query.data?.speciality },
{ label: 'Hourly Rate', value: query.data?.hourlyRate },
]}
/>
<div>
<DetailsCard
fields={[
{ label: 'Name', value: query.data?.name },
{ label: 'Username', value: query.data?.username },
{ label: 'Email', value: query.data?.email },
{ label: 'Affiliation', value: query.data?.affiliation },
{ label: 'Specialization', value: query.data?.speciality },
{
label: 'Educational Background',
value: query.data?.educationalBackground,
},
{
label: 'Date of Birth',
value:
query.data &&
new Date(query.data.dateOfBirth).toLocaleDateString(),
},
{ label: 'Specialization', value: query.data?.speciality },
{ label: 'Hourly Rate', value: query.data?.hourlyRate },
]}
/>
<div>Documents</div>
{query.data?.documents?.map((document) => (
<iframe width="600" height="300" src={document} />
))}
</div>
)
}

0 comments on commit 82085b5

Please sign in to comment.