1
+ import React , { Component } from 'react' ;
2
+ import PropTypes from 'prop-types' ;
1
3
import { httpActions } from '@codetanzania/ewea-api-client' ;
2
4
import { Connect , reduxActions } from '@codetanzania/ewea-api-states' ;
3
5
import { Col , Modal } from 'antd' ;
4
6
import { PlusOutlined } from '@ant-design/icons' ;
5
7
import isArray from 'lodash/isArray' ;
6
- import PropTypes from 'prop-types' ;
7
- import React , { Component } from 'react' ;
8
+
8
9
import NotificationForm from '../../components/NotificationForm' ;
9
10
import Topbar from '../../components/Topbar' ;
10
- import EventSeverityForm from './Form ' ;
11
+ import SettingForm from '../../components/SettingForm ' ;
11
12
import ListItemActions from '../../components/ListItemActions' ;
12
13
import ListItem from '../../components/ListItem' ;
13
14
import ItemList from '../../components/List' ;
14
15
import { notifyError , notifySuccess } from '../../util' ;
15
16
import './styles.css' ;
16
17
17
- /* constants */
18
+ /* http actions */
18
19
const {
19
20
getFocalPeople,
20
21
getJurisdictions,
@@ -23,6 +24,7 @@ const {
23
24
getAgencies,
24
25
getEventSeveritiesExportUrl,
25
26
} = httpActions ;
27
+ /* redux actions */
26
28
const {
27
29
closeEventSeverityForm,
28
30
getEventSeverities,
@@ -32,18 +34,19 @@ const {
32
34
refreshEventSeverities,
33
35
paginateEventSeverities,
34
36
deleteEventSeverity,
37
+ postEventSeverity,
38
+ putEventSeverity,
35
39
} = reduxActions ;
36
40
41
+ /* constants */
42
+ const { confirm } = Modal ;
37
43
const nameSpan = { xxl : 4 , xl : 5 , lg : 6 , md : 7 , sm : 0 , xs : 0 } ;
38
44
const descriptionSpan = { xxl : 18 , xl : 17 , lg : 16 , md : 14 , sm : 20 , xs : 18 } ;
39
-
40
45
const headerLayout = [
41
46
{ ...nameSpan , header : 'Name' } ,
42
47
{ ...descriptionSpan , header : 'Description' } ,
43
48
] ;
44
49
45
- const { confirm } = Modal ;
46
-
47
50
/**
48
51
* @class
49
52
* @name EventSeverities
@@ -201,6 +204,7 @@ class EventSeverities extends Component {
201
204
* @since 0.1.0
202
205
*/
203
206
handleAfterCloseForm = ( ) => {
207
+ selectEventSeverity ( null ) ;
204
208
this . setState ( { isEditForm : false } ) ;
205
209
} ;
206
210
@@ -381,11 +385,12 @@ class EventSeverities extends Component {
381
385
maskClosable = { false }
382
386
afterClose = { this . handleAfterCloseForm }
383
387
>
384
- < EventSeverityForm
388
+ < SettingForm
389
+ setting = { eventSeverity }
385
390
posting = { posting }
386
- isEditForm = { isEditForm }
387
- eventSeverity = { eventSeverity }
388
- onCancel = { this . closeEventSeverityForm }
391
+ onCancel = { this . handleAfterCloseForm }
392
+ onCreate = { postEventSeverity }
393
+ onUpdate = { putEventSeverity }
389
394
/>
390
395
</ Modal >
391
396
{ /* end create/edit form modal */ }
0 commit comments