Skip to content

Commit c756e1c

Browse files
authored
Merge pull request #7381 from opencrvs/revert-certificates
Revert certificates
2 parents cfd7469 + bea5a75 commit c756e1c

File tree

6 files changed

+81
-106
lines changed

6 files changed

+81
-106
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
We are dropping support for 'agentDefault' to be used as initial value for SELECT_WITH_DYNAMIC_OPTIONS type of fields. The country config package now must return the form with prepopulated initial values to show default addresses. [#6871](https://github.com/opencrvs/opencrvs-core/issues/6871)
2222

23-
- #### Remove system admin UI items: Application, Certificates, User roles, Informant notifications
23+
- #### Remove system admin UI items: Application, User roles
2424

2525
We have now moved to configuring these items directly from country configuration repository.
2626

packages/client/src/App.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { AppStore } from './store'
4747
import { CorrectionForm, CorrectionReviewForm } from './views/CorrectionForm'
4848
import { VerifyCorrector } from './views/CorrectionForm/VerifyCorrector'
4949
import { RecordAudit } from './views/RecordAudit/RecordAudit'
50+
import { CertificatesConfig } from './views/SysAdmin/Config/Certificates'
5051
import { UserList } from './views/SysAdmin/Team/user/UserList'
5152
import { SystemList } from './views/SysAdmin/Config/Systems/Systems'
5253
import VSExport from './views/SysAdmin/Vsexports/VSExport'
@@ -60,6 +61,7 @@ import { Leaderboards } from '@client/views/Performance/Leaderboards'
6061
import { PerformanceDashboard } from '@client/views/Performance/Dashboard'
6162
import { SystemRoleType } from '@client/utils/gateway'
6263
import { AdministrativeLevels } from '@client/views/Organisation/AdministrativeLevels'
64+
import InformantNotification from '@client/views/SysAdmin/Communications/InformantSMSNotification/InformantSMSNotification'
6365
import { VerifyCertificatePage } from '@client/views/VerifyCertificate/VerifyCertificatePage'
6466
import { IssueCertificate } from '@client/views/IssueCertificate/IssueCertificate'
6567
import { IssuePayment } from '@client/views/IssueCertificate/IssueCollectorForm/IssuePayment'
@@ -253,6 +255,24 @@ export function App(props: IAppProps) {
253255
}
254256
component={OfficeHome}
255257
/>
258+
<ProtectedRoute
259+
exact
260+
roles={[
261+
SystemRoleType.NationalSystemAdmin
262+
]}
263+
path={routes.CERTIFICATE_CONFIG}
264+
component={CertificatesConfig}
265+
/>
266+
<ProtectedRoute
267+
exact
268+
roles={[
269+
SystemRoleType.NationalSystemAdmin
270+
]}
271+
path={
272+
routes.INFORMANT_NOTIFICATION
273+
}
274+
component={InformantNotification}
275+
/>
256276
<ProtectedRoute
257277
exact
258278
roles={[

packages/client/src/components/interface/Navigation.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ describe('Navigation for national system admin related tests', () => {
109109
expect(testComponent.exists('#navigation_config_main')).toBeTruthy()
110110
testComponent.find('#navigation_config_main').hostNodes().simulate('click')
111111
testComponent.update()
112+
expect(testComponent.exists('#navigation_certificate')).toBeTruthy()
112113
})
113114

114115
it('No application related tabs', async () => {

packages/client/src/components/interface/Navigation.tsx

Lines changed: 59 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ import { navigationMessages } from '@client/i18n/messages/views/navigation'
1919
import {
2020
goToAdvancedSearchResult,
2121
goToAllUserEmail,
22+
goToCertificateConfig,
2223
goToDashboardView,
2324
goToHomeTab,
25+
goToInformantNotification,
2426
goToLeaderBoardsView,
2527
goToOrganisationView,
2628
goToPerformanceStatistics,
@@ -219,6 +221,7 @@ interface IProps {
219221

220222
interface IDispatchProps {
221223
goToHomeTab: typeof goToHomeTab
224+
goToCertificateConfigAction: typeof goToCertificateConfig
222225
goToVSExportsAction: typeof goToVSExport
223226
goToAdvancedSearchResultAction: typeof goToAdvancedSearchResult
224227
redirectToAuthentication: typeof redirectToAuthentication
@@ -232,6 +235,7 @@ interface IDispatchProps {
232235
goToPerformanceStatistics: typeof goToPerformanceStatistics
233236
updateRegistrarWorkqueue: typeof updateRegistrarWorkqueue
234237
setAdvancedSearchParam: typeof setAdvancedSearchParam
238+
goToInformantNotification: typeof goToInformantNotification
235239
goToAllUserEmail: typeof goToAllUserEmail
236240
}
237241

@@ -295,6 +299,7 @@ const NavigationView = (props: IFullProps) => {
295299
enableMenuSelection = true,
296300
loadWorkqueueStatuses = true,
297301
activeMenuItem,
302+
goToCertificateConfigAction,
298303
goToVSExportsAction,
299304
goToSystemViewAction,
300305
goToAdvancedSearchResultAction,
@@ -310,6 +315,7 @@ const NavigationView = (props: IFullProps) => {
310315
goToPerformanceStatistics,
311316
goToDashboardView,
312317
goToLeaderBoardsView,
318+
goToInformantNotification,
313319
goToAllUserEmail,
314320
className
315321
} = props
@@ -709,17 +715,30 @@ const NavigationView = (props: IFullProps) => {
709715
/>
710716
{(isConfigExpanded ||
711717
configTab.includes(activeMenuItem)) && (
712-
<NavigationSubItem
713-
id={`navigation_${WORKQUEUE_TABS.systems}`}
714-
label={intl.formatMessage(
715-
navigationMessages[WORKQUEUE_TABS.systems]
716-
)}
717-
onClick={goToSystemViewAction}
718-
isSelected={
719-
enableMenuSelection &&
720-
activeMenuItem === WORKQUEUE_TABS.systems
721-
}
722-
/>
718+
<>
719+
<NavigationSubItem
720+
label={intl.formatMessage(
721+
navigationMessages[WORKQUEUE_TABS.certificate]
722+
)}
723+
id={`navigation_${WORKQUEUE_TABS.certificate}`}
724+
onClick={goToCertificateConfigAction}
725+
isSelected={
726+
enableMenuSelection &&
727+
activeMenuItem === WORKQUEUE_TABS.certificate
728+
}
729+
/>
730+
<NavigationSubItem
731+
id={`navigation_${WORKQUEUE_TABS.systems}`}
732+
label={intl.formatMessage(
733+
navigationMessages[WORKQUEUE_TABS.systems]
734+
)}
735+
onClick={goToSystemViewAction}
736+
isSelected={
737+
enableMenuSelection &&
738+
activeMenuItem === WORKQUEUE_TABS.systems
739+
}
740+
/>
741+
</>
723742
)}
724743
</>
725744
)}
@@ -753,17 +772,33 @@ const NavigationView = (props: IFullProps) => {
753772
/>
754773
{(isCommunationExpanded ||
755774
conmmunicationTab.includes(activeMenuItem)) && (
756-
<NavigationSubItem
757-
label={intl.formatMessage(
758-
navigationMessages[WORKQUEUE_TABS.emailAllUsers]
759-
)}
760-
id={`navigation_${WORKQUEUE_TABS.emailAllUsers}`}
761-
onClick={goToAllUserEmail}
762-
isSelected={
763-
enableMenuSelection &&
764-
activeMenuItem === WORKQUEUE_TABS.emailAllUsers
765-
}
766-
/>
775+
<>
776+
<NavigationSubItem
777+
label={intl.formatMessage(
778+
navigationMessages[
779+
WORKQUEUE_TABS.informantNotification
780+
]
781+
)}
782+
id={`navigation_${WORKQUEUE_TABS.informantNotification}`}
783+
onClick={goToInformantNotification}
784+
isSelected={
785+
enableMenuSelection &&
786+
activeMenuItem ===
787+
WORKQUEUE_TABS.informantNotification
788+
}
789+
/>
790+
<NavigationSubItem
791+
label={intl.formatMessage(
792+
navigationMessages[WORKQUEUE_TABS.emailAllUsers]
793+
)}
794+
id={`navigation_${WORKQUEUE_TABS.emailAllUsers}`}
795+
onClick={goToAllUserEmail}
796+
isSelected={
797+
enableMenuSelection &&
798+
activeMenuItem === WORKQUEUE_TABS.emailAllUsers
799+
}
800+
/>
801+
</>
767802
)}
768803
</>
769804
)}
@@ -962,6 +997,7 @@ export const Navigation = connect<
962997
IStoreState
963998
>(mapStateToProps, {
964999
goToHomeTab,
1000+
goToCertificateConfigAction: goToCertificateConfig,
9651001
goToAdvancedSearchResultAction: goToAdvancedSearchResult,
9661002
goToVSExportsAction: goToVSExport,
9671003
goToPerformanceViewAction: goToPerformanceView,
@@ -975,6 +1011,7 @@ export const Navigation = connect<
9751011
goToPerformanceStatistics,
9761012
goToLeaderBoardsView,
9771013
goToDashboardView,
1014+
goToInformantNotification,
9781015
goToAllUserEmail
9791016
})(injectIntl(withRouter(NavigationView)))
9801017

packages/client/src/views/SysAdmin/Config/Certificates/Certificates.test.tsx

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ const fetch = createFetchMock(vi)
3131
fetch.enableMocks()
3232

3333
enum MENU_ITEM {
34-
PREVIEW,
35-
PRINT,
3634
DOWNLOAD,
3735
UPLOAD
3836
}
@@ -231,37 +229,6 @@ describe('ConfigHome page when already has uploaded certificate template', async
231229
expect(updateCertificateMutationSpy).toBeCalledTimes(1)
232230
})
233231

234-
it('should render preview certificate template when clicked on preview', async () => {
235-
await clickOnMenuItem(testComponent, 'birth', MENU_ITEM.PREVIEW)
236-
237-
await waitForElement(testComponent, '#preview_image_field')
238-
239-
expect(
240-
testComponent.find('#preview_image_field').hostNodes()
241-
).toHaveLength(1)
242-
})
243-
244-
it('should go back from preview page if click on back arrow', async () => {
245-
await clickOnMenuItem(testComponent, 'birth', MENU_ITEM.PREVIEW)
246-
await waitForElement(testComponent, '#preview_image_field')
247-
testComponent.find('#preview_close').hostNodes().simulate('click')
248-
testComponent.update()
249-
250-
expect(
251-
testComponent.find('#preview_image_field').hostNodes()
252-
).toHaveLength(0)
253-
})
254-
255-
it('should call print certificate after clicking print', async () => {
256-
await clickOnMenuItem(testComponent, 'birth', MENU_ITEM.PRINT)
257-
testComponent.update()
258-
await new Promise((resolve) => {
259-
setTimeout(resolve, 200)
260-
})
261-
262-
expect(printCertificateSpy).toBeCalledTimes(1)
263-
})
264-
265232
it('should download preview certificate', async () => {
266233
await clickOnMenuItem(testComponent, 'birth', MENU_ITEM.DOWNLOAD)
267234
await new Promise((resolve) => {

packages/client/src/views/SysAdmin/Config/Certificates/Certificates.tsx

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -206,41 +206,6 @@ class CertificatesConfigComponent extends React.Component<Props, State> {
206206
svgFilename: string
207207
) {
208208
const menuItems = [
209-
{
210-
label: intl.formatMessage(buttonMessages.preview),
211-
handler: async () => {
212-
const dummyTemplateData = getDummyCertificateTemplateData(
213-
event,
214-
this.props.registerForm
215-
)
216-
217-
svgCode = executeHandlebarsTemplate(
218-
svgCode,
219-
dummyTemplateData,
220-
this.props.state
221-
)
222-
const linkSource = `data:${SVGFile.type};base64,${window.btoa(
223-
svgCode
224-
)}`
225-
this.setState({
226-
eventName: event,
227-
previewImage: { type: SVGFile.type, data: linkSource }
228-
})
229-
}
230-
},
231-
{
232-
label: intl.formatMessage(buttonMessages.print),
233-
handler: async () => {
234-
await printDummyCertificate(
235-
event,
236-
this.props.registerForm,
237-
intl,
238-
this.props.userDetails as UserDetails,
239-
this.props.offlineResources,
240-
this.props.state
241-
)
242-
}
243-
},
244209
{
245210
label: intl.formatMessage(messages.downloadTemplate),
246211
handler: () => {
@@ -621,21 +586,6 @@ class CertificatesConfigComponent extends React.Component<Props, State> {
621586
/>
622587
}
623588
>
624-
<>
625-
{intl.formatMessage(messages.listDetails)}
626-
<Link
627-
id="certificate-instructions-link"
628-
onClick={() => {
629-
window.open(
630-
'https://documentation.opencrvs.org/setup/4.-functional-configuration/4.4-configure-a-certificate-template',
631-
'_blank',
632-
'noopener,noreferrer'
633-
)
634-
}}
635-
>
636-
{intl.formatMessage(messages.listDetailsQsn)}
637-
</Link>
638-
</>
639589
<TabContent
640590
item={
641591
CertificateSection.items.find(

0 commit comments

Comments
 (0)