Skip to content

Commit

Permalink
refactor(event-functions): improve list layout
Browse files Browse the repository at this point in the history
see #250
  • Loading branch information
lykmapipo committed May 25, 2020
1 parent 49961fd commit d8d1e6c
Show file tree
Hide file tree
Showing 4 changed files with 359 additions and 268 deletions.
12 changes: 9 additions & 3 deletions src/Events/EventFunctions/Form/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import map from 'lodash/map';
import get from 'lodash/get';
import { Button, Input, InputNumber, Form, Row, Col } from 'antd';
import { httpActions } from '@codetanzania/ewea-api-client';
Expand Down Expand Up @@ -95,7 +96,12 @@ const EventFunctionForm = ({
labelCol={labelCol}
wrapperCol={wrapperCol}
onFinish={onFinish}
initialValues={{ ...eventFunction }}
initialValues={{
...eventFunction,
relations: {
groups: map(get(eventFunction, 'relations.groups', []), '_id'),
},
}}
autoComplete="off"
>
{/* start:name */}
Expand Down Expand Up @@ -155,7 +161,7 @@ const EventFunctionForm = ({

{/* start:groups */}
<Form.Item
label="Agencies"
label="Group/Agencies"
title="Lead and Supporting Agencies e.g Police Force"
name={['relations', 'groups']}
rules={[
Expand All @@ -169,7 +175,7 @@ const EventFunctionForm = ({
onSearch={getPartyGroups}
optionLabel={(group) => get(group, 'strings.name.en')}
optionValue="_id"
initialValue={get(eventFunction, 'relations.groups', undefined)}
initialValue={get(eventFunction, 'relations.groups', [])}
mode="multiple"
/>
</Form.Item>
Expand Down
Loading

0 comments on commit d8d1e6c

Please sign in to comment.