Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ssi credential): add status for pending state only #168

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 34 additions & 22 deletions src/components/pages/AdminCredential/AdminCredentialElements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { download } from 'utils/downloadUtils'
import { useFetchNewDocumentByIdMutation } from 'features/appManagement/apiSlice'
import { error, success } from 'services/NotifyService'
import { uniqueId } from 'lodash'
import { SubscriptionStatus } from 'features/apps/apiSlice'

export interface DummyData {
date: string
Expand Down Expand Up @@ -95,6 +96,7 @@ export default function AdminCredentialElements() {
status === StatusType.APPROVE
? success(t('content.adminCertificate.approvedMessage'))
: error(t('content.adminCertificate.declinedMessage'))
setRefresh(Date.now())
})
.catch(() => {
error(t('content.adminCertificate.errorMessage'))
Expand Down Expand Up @@ -165,28 +167,38 @@ export default function AdminCredentialElements() {
flex: 2.5,
renderCell: ({ row }: { row: CredentialData }) => (
<>
<Button
size="small"
color="error"
variant="contained"
className="statusBtn"
onClick={() =>
handleApproveDecline(row.credentialDetailId, StatusType.DECLINE)
}
>
{t('global.actions.decline')}
</Button>
<Button
size="small"
color="success"
variant="contained"
className="statusBtn ml-10"
onClick={() =>
handleApproveDecline(row.credentialDetailId, StatusType.APPROVE)
}
>
{t('global.actions.confirm')}
</Button>
{row.participantStatus === SubscriptionStatus.PENDING && (
<>
<Button
size="small"
color="error"
variant="contained"
className="statusBtn"
onClick={() =>
handleApproveDecline(
row.credentialDetailId,
StatusType.DECLINE
)
}
>
{t('global.actions.decline')}
</Button>
<Button
size="small"
color="success"
variant="contained"
className="statusBtn ml-10"
onClick={() =>
handleApproveDecline(
row.credentialDetailId,
StatusType.APPROVE
)
}
>
{t('global.actions.confirm')}
</Button>
</>
)}
</>
),
},
Expand Down