import React, { useState, useEffect, useCallback } from 'react';
import {Container} from "react-bootstrap";
import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";
import Form from 'react-bootstrap/Form'
import Button from "react-bootstrap/Button";
import * as EgovNet from "api/egovFetch";

function ParentCodeDiv(props){

    const [codeGrpRow, setCodeGrpRow] = useState();

    function getCodeGrp(){
        EgovNet.requestFetch(
            '/admin/config/code-grp',
            {
                method: "GET",
                headers: {
                    'Content-type': 'application/json'
                },
                body: JSON.stringify({})
            },
            (resp) => {
                debugger
            },
            function (resp) {
                console.log("err response : ", resp);
            }
        );
    }

    useEffect(() => {
        getCodeGrp();
    }, []);

    return (
        <Container className={"pt-3"}>
            <Row className={"py-2 bg-light border-bottom"}>
                <Col xs={4}>코드그룹</Col>
                <Col xs={4}>코드그룹명</Col>
                <Col xs={2}>삭제</Col>
                <Col xs={2}>수정</Col>
            </Row>
            {codeGrpRow}
            <Row className={"py-1"}>
                <Col xs={4}>
                    <Form.Control type={"text"} placeholder={"코드그룹"} size={"sm"}/>
                </Col>
                <Col xs={4}>
                    <Form.Control type={"text"} placeholder={"코드그룹명"} size={"sm"}/>
                </Col>
                <Col xs={{span:2, offset:2}}><Button type={"button"} variant={"primary"} size={"sm"}>등록</Button></Col>
            </Row>
        </Container>
    );
}

export default ParentCodeDiv;