import React,{Component} from 'react'

import { Form, Input, DatePicker,Row, Col,Button,Icon ,Select} from 'antd';
const FormItem = Form.Item;


export default class T22F extends Component
{

    name='22F'
    desp = "Linkage Type Indicator"
    pattern = ":4!c/[8c]/4!c"
    tno = -1

    keys = [1,2,3]

    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 mval = `:${obj.s1}//${obj.s3}`
        if(obj.s2)
        mval = `:${obj.s1}/${obj.s2}/${obj.s3}`
        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 style={{"minWidth":'100px'}} span={3}>
                <FormItem
                    label="Qualifier"
                       required={this.props.status=='M' || mval?'required':null}
                  help={errmsg.s1}
                    validateStatus={errmsg.s1?'error':null}
                >
                           <Select

                           placeholder="Qualifier"
                           showSearch

                           allowClear={true}
                            optionFilterProp="children"
                            notFoundContent="Wrong Code"
                            style={{ width: "100%" }} value={value.s1} onChange={val=>this.onChange(1,val)} >

                                   <Option  value="LINK">LINK</Option>
                                   <Option  value="MICO">MICO</Option>
                                   <Option  value="FORM">FORM</Option>
                                   <Option  value="PFRE">PFRE</Option>
                                   <Option  value="PAYS">PAYS</Option>
                                   <Option  value="CFRE">FORM</Option>
                                   <Option  value="PROC">PROC</Option>
                                   <Option  value="PROR">PROR</Option>
                                   <Option  value="PRIR">PRIR</Option>
                                   <Option  value="BORR">BORR</Option>
                                   <Option  value="TTCO">TTCO</Option>
                                   <Option  value="INCA">INCA</Option>
                                   <Option  value="TRCA">TRCA</Option>
                                   <Option  value="PRIC">PRIC</Option>
                                   <Option  value="RERT">RERT</Option>
                                   <Option  value="REVA">REVA</Option>
                                   <Option  value="LEGA">LEGA</Option>
                                   <Option  value="OMAT">OMAT</Option>
                                   <Option  value="INTR">INTR</Option>
                                   <Option  value="STCO">STCO</Option>
                                   <Option  value="SETR">SETR</Option>
                                   <Option  value="STAM">STAM</Option>
                                   <Option  value="RTGS">RTGS</Option>
                                   <Option  value="REGT">REGT</Option>
                                   <Option  value="BEBE">BENE</Option>
                                   <Option  value="CASY">CASY</Option>
                                   <Option  value="DBNM">DBNM</Option>
                                   <Option  value="TCPI">TCPI</Option>
                                   <Option  value="MACL">MACL</Option>
                                   <Option  value="FXCX">FXCX</Option>
                                   <Option  value="BLOC">BLOC</Option>
                                   <Option  value="REST">REST</Option>
                                   <Option  value="SETS">SETS</Option>
                                   <Option  value="NETT">NETT</Option>
                                   <Option  value="CCPT">CCPT</Option>
                                   <Option  value="LEOG">LEOG</Option>
                                   <Option  value="COLA">COLA</Option>
                                   <Option  value="TRAK">TRAK</Option>
                                   <Option  value="REPT">REPT</Option>
                                   <Option  value="COLE">COLE</Option>
                                   <Option  value="SSBT">SSBT</Option>
                                   <Option  value="CSBT">CSBT</Option>
                            </Select>
                </FormItem>
            </Col>

            <Col span={12}>
                <FormItem
                    label="Data Source Scheme"
                    help={errmsg.s2}
                    validateStatus={errmsg.s2 ? 'error' : null}
                >

                    <Input type="text" value={value.s2}  addonBefore="/" onChange={e =>this.onChange(2, e.target.value)} maxLength={8} style={{ imeMode:'disabled'}} placeholder="Data Source Scheme" />
                </FormItem>
            </Col>

            <Col style={{"minWidth":'100px'}} span={3}>
                <FormItem
                    label="Indicator"
                       required={this.props.status=='M' || mval?'required':null}
                  help={errmsg.s3}
                    validateStatus={errmsg.s3?'error':null}
                >
                           <Select

                           placeholder="Indicator"
                           showSearch

                           allowClear={true}
                            optionFilterProp="children"
                            notFoundContent="Wrong Code"
                            style={{ width: "100%" }} value={value.s3} onChange={val=>this.onChange(3,val)} >

                                <Option  value="LINK">LINK</Option>

                                <Option  value="BEAR">BEAR</Option>
                                <Option  value="REGD">REGD</Option>
                                <Option  value="ANNU">ANNU</Option>
                                <Option  value="MNTH">MNTH</Option>
                                <Option  value="QUTR">QUTR</Option>
                                <Option  value="SEMI">SEMI</Option>
                                <Option  value="WEEK">WEEK</Option>
                                <Option  value="FULL">FULL</Option>
                                <Option  value="NILL">NILL</Option>
                                <Option  value="PART">PART</Option>

                                <Option  value="CLOP">CLOP</Option>
                                <Option  value="OPEP">OPEP</Option>
                                <Option  value="BYIY">BYIY</Option>
                                <Option  value="DEFR">DEFR</Option>
                                <Option  value="EXCH">EXCH</Option>
                                <Option  value="TRRE">TRRE</Option>
                                <Option  value="LAMI">LAMI</Option>
                                <Option  value="NBOR">NBOR</Option>
                                <Option  value="YBOR">YBOR</Option>
                                <Option  value="BCBL">BCBL</Option>
                                <Option  value="BCBN">BCBN</Option>
                                <Option  value="BCFD">BCFD</Option>
                                <Option  value="BCPD">BCPD</Option>
                                <Option  value="BCRO">BCRO</Option>
                                <Option  value="BCRP">BCRP</Option>
                                <Option  value="CBNS">CBNS</Option>
                                <Option  value="CCPN">CCPN</Option>
                                <Option  value="CDIV">CDIV</Option>
                                <Option  value="CRTS">CRTS</Option>
                                <Option  value="CWAR">CWAR</Option>
                                <Option  value="GTDL">GTDL</Option>
                                <Option  value="MAPR">MAPR</Option>
                                <Option  value="NEGO">NEGO</Option>
                                <Option  value="NMPR">NMPR</Option>
                                <Option  value="SPCU">SPCU</Option>
                                <Option  value="SPEX">SPEX</Option>
                                <Option  value="XBNS">XBNS</Option>
                                <Option  value="XCPN">XCPN</Option>
                                <Option  value="XDIV">XDIV</Option>
                                <Option  value="XRTS">XRTS</Option>
                                <Option  value="XWAR">XWAR</Option>
                                <Option  value="ELIG">ELIG</Option>
                                <Option  value="PROF">PROF</Option>
                                <Option  value="RETL">RETL</Option>
                                <Option  value="INFI">INFI</Option>
                                <Option  value="MKTM">MKTM</Option>
                                <Option  value="MLTF">MLTF</Option>
                                <Option  value="RMKT">RMKT</Option>
                                <Option  value="SINT">SINT</Option>
                                <Option  value="TAGT">TAGT</Option>

                                <Option  value="AVER">AVER</Option>

                                <Option  value="FIXE">FIXE</Option>
                                <Option  value="FORF">FORF</Option>
                                <Option  value="VARI">VARI</Option>
                                <Option  value="A001">A001</Option>
                                <Option  value="A002">A002</Option>
                                <Option  value="A003">A003</Option>
                                <Option  value="A004">A004</Option>
                                <Option  value="A005">A005</Option>
                                <Option  value="A006">A006</Option>
                                <Option  value="A007">A007</Option>
                                <Option  value="A008">A008</Option>
                                <Option  value="A009">A009</Option>
                                <Option  value="A010">A010</Option>
                                <Option  value="A011">A011</Option>
                                <Option  value="A012">A012</Option>
                                <Option  value="A013">A013</Option>
                                <Option  value="A014">A014</Option>
                                <Option  value="OTHR">OTHR</Option>
                                <Option  value="REVY">REVY</Option>
                                <Option  value="REVN">REVN</Option>
                                <Option  value="FRAN">FRAN</Option>
                                <Option  value="MATA">MATA</Option>
                                <Option  value="MATN">MATN</Option>
                                <Option  value="GIVE">GIVE</Option>
                                <Option  value="TAKE">TAKE</Option>

                                <Option  value="ASGN">ASGN</Option>
                                <Option  value="BUTC">BUTC</Option>
                                <Option  value="CLEN">CLEN</Option>
                                <Option  value="DIRT">DIRT</Option>
                                <Option  value="DLWM">DLWM</Option>
                                <Option  value="DRAW">DRAW</Option>
                                <Option  value="EXER">EXER</Option>
                                <Option  value="FRCL">FRCL</Option>
                                <Option  value="KNOC">KNOC</Option>
                                <Option  value="NACT">NACT</Option>
                                <Option  value="NOMC">NOMC</Option>
                                <Option  value="NPAR">NPAR</Option>
                                <Option  value="PART">PART</Option>
                                <Option  value="PHYS">PHYS</Option>
                                <Option  value="RESI">RESI</Option>
                                <Option  value="RHYP">RHYP</Option>
                                <Option  value="RPTO">RPTO</Option>
                                <Option  value="SPDL">SPDL</Option>
                                <Option  value="SPST">SPST</Option>
                                <Option  value="TRAN">TRAN</Option>
                                <Option  value="TRIP">TRIP</Option>
                                <Option  value="UNEX">UNEX</Option>
                                <Option  value="BSBK">BSBK</Option>
                                <Option  value="BYIY">BYIY</Option>
                                <Option  value="CLAI">CLAI</Option>
                                <Option  value="CNCB">CNCB</Option>
                                <Option  value="COLI">COLI</Option>
                                <Option  value="COLO">COLO</Option>
                                <Option  value="CONV">CONV</Option>
                                <Option  value="ETFT">ETFT</Option>
                                <Option  value="FCTA">FCTA</Option>
                                <Option  value="INSP">INSP</Option>
                                <Option  value="ISSU">ISSU</Option>
                                <Option  value="MKDW">MKDW</Option>
                                <Option  value="MKUP">MKUP</Option>
                                <Option  value="NETT">NETT</Option>
                                <Option  value="NSYN">NSYN</Option>
                                <Option  value="OWNE">OWNE</Option>
                                <Option  value="OWNI">OWNI</Option>
                                <Option  value="PAIR">PAIR</Option>
                                <Option  value="PLAC">PLAC</Option>
                                <Option  value="PORT">PORT</Option>
                                <Option  value="REAL">REAL</Option>
                                <Option  value="REDI">REDI</Option>
                                <Option  value="REDM">REDM</Option>
                                <Option  value="RELE">RELE</Option>
                                <Option  value="REPU">REPU</Option>
                                <Option  value="RODE">RODE</Option>
                                <Option  value="RVPO">RVPO</Option>
                                <Option  value="SBBK">SBBK</Option>
                                <Option  value="SBRE">SBRE</Option>
                                <Option  value="SECB">SECB</Option>
                                <Option  value="SECL">SECL</Option>
                                <Option  value="SLRE">SLRE</Option>
                                <Option  value="SUBS">SUBS</Option>
                                <Option  value="SWIF">SWIF</Option>
                                <Option  value="SWIT">SWIT</Option>
                                <Option  value="SYND">SYND</Option>
                                <Option  value="TBAC">TBAC</Option>
                                <Option  value="TRAD">TRAD</Option>
                                <Option  value="TRPO">TRPO</Option>
                                <Option  value="TRVO">TRVO</Option>
                                <Option  value="TURN">TURN</Option>
                                <Option  value="CUST">CUST</Option>
                                <Option  value="RISP">RISP</Option>
                                <Option  value="SAGE">SAGE</Option>
                                <Option  value="SPRI">SPRI</Option>
                                <Option  value="NRTG">NRTG</Option>
                                <Option  value="YRTG">YRTG</Option>
                                <Option  value="NREG">NREG</Option>
                                <Option  value="YREG">YREG</Option>
                                <Option  value="NBEN">NBEN</Option>
                                <Option  value="YBEN">YBEN</Option>
                                <Option  value="GROS">GROS</Option>
                                <Option  value="NETS">NETS</Option>
                                <Option  value="BRKR">BRKR</Option>
                                <Option  value="INTE">INTE</Option>
                                <Option  value="VEND">VEND</Option>
                                <Option  value="AGEN">AGEN</Option>
                                <Option  value="PRIN">PRIN</Option>
                                <Option  value="CLNT">CLNT</Option>
                                <Option  value="MAKT">MAKT</Option>
                                <Option  value="FXNO">FXNO</Option>
                                <Option  value="FXYE">FXYE</Option>
                                <Option  value="SINO">SINO</Option>
                                <Option  value="BLCH">BLCH</Option>
                                <Option  value="BLPA">BLPA</Option>
                                <Option  value="144A">144A</Option>
                                <Option  value="NRST">NRST</Option>
                                <Option  value="RSTR">RSTR</Option>
                                <Option  value="NSET">NSET</Option>
                                <Option  value="YSET">YSET</Option>
                                <Option  value="NNET">NNET</Option>
                                <Option  value="YNET">YNET</Option>
                                <Option  value="NCCP">NCCP</Option>
                                <Option  value="YCCP">YCCP</Option>
                                <Option  value="NLEG">NLEG</Option>
                                <Option  value="YLEG">YLEG</Option>
                                <Option  value="BFWD">BFWD</Option>
                                <Option  value="CCIR">CCIR</Option>
                                <Option  value="CCPC">CCPC</Option>
                                <Option  value="COMM">COMM</Option>
                                <Option  value="CRDS">CRDS</Option>
                                <Option  value="CRPR">CRPR</Option>
                                <Option  value="CRSP">CRSP</Option>
                                <Option  value="CRTL">CRTL</Option>
                                <Option  value="EQPT">EQPT</Option>
                                <Option  value="EQUS">EQUS</Option>
                                <Option  value="EXPT">EXPT</Option>
                                <Option  value="EXTD">EXTD</Option>
                                <Option  value="FIXI">FIXI</Option>
                                <Option  value="FORW">FORW</Option>
                                <Option  value="FORX">FORX</Option>
                                <Option  value="FUTR">FUTR</Option>
                                <Option  value="LIQU">LIQU</Option>
                                <Option  value="OPTN">OPTN</Option>
                                <Option  value="OTCD">OTCD</Option>
                                <Option  value="PAYM">PAYM</Option>
                                <Option  value="REPO">REPO</Option>
                                <Option  value="RVPO">RVPO</Option>
                                <Option  value="SBSB">SBSB</Option>
                                <Option  value="SCIE">SCIE</Option>
                                <Option  value="SCIR">SCIR</Option>
                                <Option  value="SCRP">SCRP</Option>
                                <Option  value="SLEB">SLEB</Option>
                                <Option  value="SLOA">SLOA</Option>
                                <Option  value="SWPT">SWPT</Option>
                                <Option  value="TBAS">TBAS</Option>
                                <Option  value="TCRP">TCRP</Option>
                                <Option  value="UNTR">UNTR</Option>
                                <Option  value="TRAC">TRAC</Option>
                                <Option  value="CADJ">CADJ</Option>
                                <Option  value="CALL">CALL</Option>
                                <Option  value="PADJ">PADJ</Option>
                                <Option  value="PAIR">PAIR</Option>
                                <Option  value="RATE">RATE</Option>
                                <Option  value="ROLP">ROLP</Option>
                                <Option  value="TOPU">TOPU</Option>
                                <Option  value="WTHD">WTHD</Option>
                                <Option  value="COLA">COLA</Option>
                                <Option  value="COLN">COLN</Option>
                                <Option  value="UDMS">UDMS</Option>
                            </Select>
                </FormItem>
            </Col>
        </Row>)
    }
}
