Skip to content

Commit d8d1e6c

Browse files
committed
refactor(event-functions): improve list layout
see #250
1 parent 49961fd commit d8d1e6c

File tree

4 files changed

+359
-268
lines changed

4 files changed

+359
-268
lines changed

src/Events/EventFunctions/Form/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import map from 'lodash/map';
34
import get from 'lodash/get';
45
import { Button, Input, InputNumber, Form, Row, Col } from 'antd';
56
import { httpActions } from '@codetanzania/ewea-api-client';
@@ -95,7 +96,12 @@ const EventFunctionForm = ({
9596
labelCol={labelCol}
9697
wrapperCol={wrapperCol}
9798
onFinish={onFinish}
98-
initialValues={{ ...eventFunction }}
99+
initialValues={{
100+
...eventFunction,
101+
relations: {
102+
groups: map(get(eventFunction, 'relations.groups', []), '_id'),
103+
},
104+
}}
99105
autoComplete="off"
100106
>
101107
{/* start:name */}
@@ -155,7 +161,7 @@ const EventFunctionForm = ({
155161

156162
{/* start:groups */}
157163
<Form.Item
158-
label="Agencies"
164+
label="Group/Agencies"
159165
title="Lead and Supporting Agencies e.g Police Force"
160166
name={['relations', 'groups']}
161167
rules={[
@@ -169,7 +175,7 @@ const EventFunctionForm = ({
169175
onSearch={getPartyGroups}
170176
optionLabel={(group) => get(group, 'strings.name.en')}
171177
optionValue="_id"
172-
initialValue={get(eventFunction, 'relations.groups', undefined)}
178+
initialValue={get(eventFunction, 'relations.groups', [])}
173179
mode="multiple"
174180
/>
175181
</Form.Item>

0 commit comments

Comments
 (0)