import React, { useState, useEffect } from 'react';
import ReferenceCodePopupDialog from './ReferenceCodePopupDialog'


import styled from "styled-components";
const StyledDiv = styled.div`
    input {
        background: #fafafa;
        cursor: pointer;
    }
`;


function ReferenceCodePopupInput(props) {
    const {requestItems,setRequestItems} = props;

    const [open, setOpen] = useState(false);

    return (
        <StyledDiv>
            <input className="f_input2 w_full" type="text" name="categoryId" title="기준코드 선택" placeholder="여기를 눌러 기준코드를 선택하세요"
                
                value={requestItems.categoryId}
                onChange={(e) => setRequestItems({ ...requestItems, categoryId: e.target.value })}
                onClick={(e) => {
                    setOpen(true);
                }}
            />
            <ReferenceCodePopupDialog open={open} setOpen={setOpen}/>
        </StyledDiv>
    );
}

export default ReferenceCodePopupInput;