Skip to content

Commit 1c183be

Browse files
committed
refactor(event-urgency): migrate form to antd v4
1 parent b9d8fe8 commit 1c183be

File tree

2 files changed

+15
-175
lines changed

2 files changed

+15
-175
lines changed

src/Events/EventUrgencies/Form/index.js

-165
This file was deleted.

src/Events/EventUrgencies/index.js

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1+
import React, { Component } from 'react';
2+
import PropTypes from 'prop-types';
13
import { httpActions } from '@codetanzania/ewea-api-client';
24
import { Connect, reduxActions } from '@codetanzania/ewea-api-states';
35
import { Col, Modal } from 'antd';
46
import { PlusOutlined } from '@ant-design/icons';
57
import isArray from 'lodash/isArray';
68
import get from 'lodash/get';
7-
import PropTypes from 'prop-types';
8-
import React, { Component } from 'react';
9+
910
import NotificationForm from '../../components/NotificationForm';
1011
import Topbar from '../../components/Topbar';
11-
import EventUrgencyForm from './Form';
12+
import SettingForm from '../../components/SettingForm';
1213
import ListItemActions from '../../components/ListItemActions';
1314
import ListItem from '../../components/ListItem';
1415
import ItemList from '../../components/List';
1516
import { notifyError, notifySuccess } from '../../util';
1617
import './styles.css';
1718

18-
/* constants */
19+
/* http actions */
1920
const {
2021
getFocalPeople,
2122
getJurisdictions,
@@ -24,6 +25,7 @@ const {
2425
getAgencies,
2526
getEventUrgenciesExportUrl,
2627
} = httpActions;
28+
/* redux actions */
2729
const {
2830
closeEventUrgencyForm,
2931
getEventUrgencies,
@@ -33,18 +35,19 @@ const {
3335
refreshEventUrgencies,
3436
paginateEventUrgencies,
3537
deleteEventUrgency,
38+
postEventUrgency,
39+
putEventUrgency,
3640
} = reduxActions;
3741

42+
/* constants */
43+
const { confirm } = Modal;
3844
const nameSpan = { xxl: 4, xl: 5, lg: 6, md: 7, sm: 0, xs: 0 };
3945
const descriptionSpan = { xxl: 18, xl: 17, lg: 16, md: 14, sm: 20, xs: 18 };
40-
4146
const headerLayout = [
4247
{ ...nameSpan, header: 'Name' },
4348
{ ...descriptionSpan, header: 'Description' },
4449
];
4550

46-
const { confirm } = Modal;
47-
4851
/**
4952
* @class
5053
* @name EventUrgency
@@ -202,6 +205,7 @@ class EventUrgency extends Component {
202205
* @since 0.1.0
203206
*/
204207
handleAfterCloseForm = () => {
208+
selectEventUrgency(null);
205209
this.setState({ isEditForm: false });
206210
};
207211

@@ -383,10 +387,11 @@ class EventUrgency extends Component {
383387
maskClosable={false}
384388
afterClose={this.handleAfterCloseForm}
385389
>
386-
<EventUrgencyForm
390+
<SettingForm
391+
setting={eventUrgency}
387392
posting={posting}
388-
isEditForm={isEditForm}
389-
eventUrgency={eventUrgency}
393+
onCreate={postEventUrgency}
394+
onUpdate={putEventUrgency}
390395
onCancel={this.closeEventUrgencyForm}
391396
/>
392397
</Modal>

0 commit comments

Comments
 (0)