WA-238 Including Daily Limit in form

This commit is contained in:
apanizo 2018-04-27 12:48:03 +02:00
parent 4b39ebf987
commit 854952f126
3 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,22 @@
// @flow
import * as React from 'react'
import Field from '~/components/forms/Field'
import TextField from '~/components/forms/TextField'
import { composeValidators, mustBeNumber, required, minValue } from '~/components/forms/validator'
import Block from '~/components/layout/Block'
import { FIELD_DAILY_LIMIT } from '~/routes/open/components/fields'
const DailyLimit = () => (
<Block margin="md">
<Field
name={FIELD_DAILY_LIMIT}
component={TextField}
type="text"
validate={composeValidators(required, mustBeNumber, minValue(1))}
placeholder="Daily Limit*"
text="Daily Limit"
/>
</Block>
)
export default DailyLimit

View File

@ -6,6 +6,7 @@ import { getAccountsFrom } from '~/routes/open/utils/safeDataExtractor'
import Name from './Name' import Name from './Name'
import Owners from './Owners' import Owners from './Owners'
import Confirmations from './Confirmations' import Confirmations from './Confirmations'
import DailyLimit from './DailyLimit'
export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners' export const CONFIRMATIONS_ERROR = 'Number of confirmations can not be higher than the number of owners'
@ -25,5 +26,6 @@ export default () => ({ values }: Object) => (
<Name /> <Name />
<Owners numOwners={values.owners} otherAccounts={getAccountsFrom(values)} /> <Owners numOwners={values.owners} otherAccounts={getAccountsFrom(values)} />
<Confirmations /> <Confirmations />
<DailyLimit />
</Block> </Block>
) )

View File

@ -2,6 +2,7 @@
export const FIELD_NAME: string = 'name' export const FIELD_NAME: string = 'name'
export const FIELD_CONFIRMATIONS: string = 'confirmations' export const FIELD_CONFIRMATIONS: string = 'confirmations'
export const FIELD_OWNERS: string = 'owners' export const FIELD_OWNERS: string = 'owners'
export const FIELD_DAILY_LIMIT: string = 'limit'
export const getOwnerNameBy = (index: number) => `owner${index}Name` export const getOwnerNameBy = (index: number) => `owner${index}Name`
export const getOwnerAddressBy = (index: number) => `owner${index}Address` export const getOwnerAddressBy = (index: number) => `owner${index}Address`