Skip to content

Commit

Permalink
fix: amend date of certification for verifying certificate (#7098)
Browse files Browse the repository at this point in the history
* fix: amend date of certification for verifying certificate

* Revert "fix: amend date of certification for verifying certificate"

This reverts commit 785a85b.

* fix: show certified date in qr code verification page

* chore: add comment for last certfied date

* fix: amend certificate time extraction logic

* fix: update certified at message id
  • Loading branch information
Nil20 authored Jun 20, 2024
1 parent 0ddf7af commit cd78a6e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/client/src/i18n/messages/views/verifyCertificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interface IVerifyCertificateMessages
registar: MessageDescriptor
brn: MessageDescriptor
drn: MessageDescriptor
createdAt: MessageDescriptor
certifiedAt: MessageDescriptor
toastMessage: MessageDescriptor
}

Expand Down Expand Up @@ -110,8 +110,8 @@ const messagesToDefine: IVerifyCertificateMessages = {
defaultMessage: 'Name of registar',
description: 'Label for name of registar center'
},
createdAt: {
id: 'verifyCertificate.createdAt',
certifiedAt: {
id: 'verifyCertificate.certifiedAt',
defaultMessage: 'Date of certification',
description: 'Label for date of certification'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { compact } from 'lodash'
import { useVerificationRecordDetails } from './useVerificationRecordDetails'
import { useLocationIntl } from '@client/hooks/useLocationIntl'
import { generateFullAddress } from '@client/utils/locationUtils'
import { SUBMISSION_STATUS } from '@client/declarations'

const Container = styled.div<{ size: string; checking: boolean }>`
position: relative;
Expand Down Expand Up @@ -246,6 +247,16 @@ export function VerifyCertificatePage() {
if (isDeathRegistration(data)) return data.deceased?.gender
}

const getLastCertifiedDate = (data: RecordDetails) => {
// find first certified action from history sorted in ascending order by time
return (
data.history &&
data.history.find(
(item) => item?.regStatus?.toString() === SUBMISSION_STATUS.CERTIFIED
)
)?.date
}

// This function currently supports upto two location levels
const getLocation = (data: RecordDetails) => {
const location = data.eventLocation
Expand Down Expand Up @@ -477,12 +488,15 @@ export function VerifyCertificatePage() {
<ListViewItemSimplified
label={
<Text variant={'bold16'} element={'span'}>
{intl.formatMessage(messageToDefine.createdAt)}
{intl.formatMessage(messageToDefine.certifiedAt)}
</Text>
}
value={
<Text variant={'reg16'} element={'span'}>
{formatDate(new Date(data.createdAt), 'dd MMMM yyyy')}
{formatDate(
new Date(getLastCertifiedDate(data)),
'dd MMMM yyyy'
)}
</Text>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const FETCH_RECORD_DETAILS_FOR_VERIFICATION = gql`
history {
action
regStatus
date
user {
primaryOffice {
hierarchy {
Expand Down

0 comments on commit cd78a6e

Please sign in to comment.