Skip to content

Commit 831d55e

Browse files
committed
refactor(event-certainties): migrate form to antd v4
see #250
1 parent 7983cd4 commit 831d55e

File tree

2 files changed

+23
-221
lines changed

2 files changed

+23
-221
lines changed

src/Events/EventCertainty/Form/index.js

-203
This file was deleted.

src/Events/EventCertainty/index.js

+23-18
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1+
import PropTypes from 'prop-types';
2+
import React, { Component } from 'react';
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';
6-
import PropTypes from 'prop-types';
7-
import React, { Component } from 'react';
8+
89
import NotificationForm from '../../components/NotificationForm';
910
import Topbar from '../../components/Topbar';
10-
import EventCertaintyForm from './Form';
11+
import SettingForm from '../../components/SettingForm';
1112
import ListItemActions from '../../components/ListItemActions';
1213
import ListItem from '../../components/ListItem';
1314
import ItemList from '../../components/List';
1415
import { notifyError, notifySuccess } from '../../util';
1516
import './styles.css';
1617

17-
/* constants */
18+
/* http actions */
19+
const {
20+
getFocalPeople,
21+
getJurisdictions,
22+
getPartyGroups,
23+
getRoles,
24+
getAgencies,
25+
getEventCertaintiesExportUrl,
26+
} = httpActions;
27+
/* redux actions */
1828
const {
1929
closeEventCertaintyForm,
2030
getEventCertainties,
@@ -24,26 +34,19 @@ const {
2434
refreshEventCertainties,
2535
paginateEventCertainties,
2636
deleteEventCertainty,
37+
postEventCertainty,
38+
putEventCertainty,
2739
} = reduxActions;
28-
const {
29-
getFocalPeople,
30-
getJurisdictions,
31-
getPartyGroups,
32-
getRoles,
33-
getAgencies,
34-
getEventCertaintiesExportUrl,
35-
} = httpActions;
3640

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

45-
const { confirm } = Modal;
46-
4750
/**
4851
* @class
4952
* @name EventCertainties
@@ -201,6 +204,7 @@ class EventCertainties extends Component {
201204
* @since 0.1.0
202205
*/
203206
handleAfterCloseForm = () => {
207+
selectEventCertainty(null);
204208
this.setState({ isEditForm: false });
205209
};
206210

@@ -384,11 +388,12 @@ class EventCertainties extends Component {
384388
maskClosable={false}
385389
afterClose={this.handleAfterCloseForm}
386390
>
387-
<EventCertaintyForm
391+
<SettingForm
392+
setting={eventCertainty}
388393
posting={posting}
389-
isEditForm={isEditForm}
390-
eventCertainty={eventCertainty}
391394
onCancel={this.closeEventCertaintyForm}
395+
onCreate={postEventCertainty}
396+
onUpdate={putEventCertainty}
392397
/>
393398
</Modal>
394399
{/* end create/edit form modal */}

0 commit comments

Comments
 (0)