import React, { Component } from 'react'

import { Form, Input, DatePicker, Row, Col, Button, Icon, Select } from 'antd';
import {InputSize,Currency,COUNTRY} from "./Utils"

const FormItem = Form.Item;
const Option = Select.Option

export default class T39M extends Component {

    name = '39M'
    desp = "Country Code"

    pattern = "2!a"
    tno = -1

    onChange = (val) => {
        this.props.onValue([{ s1: val }, val])
    }

    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 style={{"minWidth":'100px'}} span={15}>
                <FormItem
                    required
                >
                           <Select  placeholder="Country Code"
                            showSearch
                            allowClear={true}
                            optionFilterProp="children"
                            notFoundContent="Wrong Code"
                             size={InputSize}  style={{ width: "100%",zIndex:99 }}  value={value.s1} onChange={(val)=>this.onChange(val)}>
                                
                                {
                                    COUNTRY.map(item=><Option key={item.code}  value={item.code}>{item.code+'-'+item.name}</Option>)
                                }
                            </Select>
                </FormItem>
            </Col>
        </Row>)

    }
}