import React,{Component} from 'react'

import { Form, Input, DatePicker,Row, Col,Button,Icon ,Select} from 'antd';

import {FormatAmount} from './Utils'
const FormItem = Form.Item;


export default class T36 extends Component
{

    name='36'
    desp = "Currency/Instructed Amount"
    
    pattern = "12d"
    tno = -1

    keys=[1]

    onChange=(index,value)=>
    {
        let obj = {};
        if(!value)
            value = ""
        let objtemp =this.props.value
        
        objtemp = objtemp && objtemp.length? objtemp[0] : {}

        objtemp["s"+index] = value;

        this.keys.forEach(i=>{
            obj['s'+i] = objtemp['s'+i]
        });
        let temp = FormatAmount(obj.s1);
        
        let mval = `${temp}`
        this.props.onValue([obj,mval])
    }

    render()
    {
        let value =this.props.value

        let mval = value && value.length? value[1] : ''
        let errmsg = value && value.length==3?value[2]:{}

        value = value && value.length? value[0] : {}
        return (<Row>
            <Col span={12}>
                <FormItem
                  
                 help={errmsg.s1}
                    validateStatus={errmsg.s1?'error':null}
                >
                        
                        <Input  value={value.s1} onChange={e=>this.onChange(1,e.target.value)} maxLength={13} style={{imeMode:'disabled'}} placeholder="Amount"/>
                </FormItem>
            </Col>
        </Row>)
    }
}