-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.tsx
74 lines (67 loc) · 2.21 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import ProCard from '@ant-design/pro-card';
import { PageContainer } from '@ant-design/pro-layout';
import React from 'react';
import { FormattedMessage, history, useAccess, useParams } from 'umi';
import { useCheckRoles } from '@/hooks/useCheckRoles';
import ConfigList from './ConfigList/index';
export enum channelType {
email = 'EscolaLms\\TemplatesEmail\\Core\\EmailChannel',
pdf = 'EscolaLms\\TemplatesPdf\\Core\\PdfChannel',
sms = 'EscolaLms\\TemplatesSms\\Core\\SmsChannel',
}
const Templates: React.FC = () => {
const params = useParams<{ template?: string }>();
const { template } = params;
const access = useAccess();
const { checkRoles } = useCheckRoles();
const hideSMSTab = checkRoles('hideTemplateTab-sms');
const hideEmailTab = checkRoles('hideTemplateTab-email');
return (
<PageContainer>
<ProCard
tabs={{
type: 'card',
activeKey: template,
onChange: (key) => history.push(`/configuration/templates/${key}`),
}}
>
{/** TODO check here if all essential access is given */}
{!hideEmailTab && (
<ProCard.TabPane key="email" tab={<FormattedMessage id="email" />}>
<ConfigList templateType={'email'} channel={channelType.email} />
</ProCard.TabPane>
)}
{access.certificatesPermission && (
<ProCard.TabPane key={'pdf'} tab={<FormattedMessage id="PDF" />}>
<ConfigList templateType={'pdf'} channel={channelType.pdf} />
</ProCard.TabPane>
)}
{/* This was disabled so remove comment when functionality will be ready */}
{/* <ProCard.TabPane
disabled
key={'Push'}
tab={
<span>
<FormattedMessage id="Push" />
</span>
}
>
Push
</ProCard.TabPane> */}
{!hideSMSTab && (
<ProCard.TabPane
key={'sms'}
tab={
<span>
<FormattedMessage id="SMS" />
</span>
}
>
<ConfigList templateType={'sms'} channel={channelType.sms} />
</ProCard.TabPane>
)}
</ProCard>
</PageContainer>
);
};
export default Templates;