<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="dateUtil" uri="http://egovframework.go.kr/functions/date-util" %>

<div class="popup_wrap">
    <div class="popup_inner">
        <div class="popup_tit">
            <h2 class="tit">자동차 등록원부 정보</h2>
            <a href="#" class="pop-x-btn modalclose"></a>
        </div>
        <div class="popup_con">
            <div class="forms_table_non">
                <table>
                    <colgroup>
                        <col style="width: 20%;" />
                        <col style="width: 30%;" />
                        <col style="width: 20%;" />
                        <col style="width: 30%;" />
                    </colgroup>
                    <tr>
                        <th class="th">연계결과코드</th>
                        <td id="linkRsltCd">${data.linkRsltCd}</td>
                        <th class="th">연계결과상세</th>
                        <td id="linkRsltDtl">${data.linkRsltDtl}</td>
                    </tr>
                    <tr>
                        <th class="th">원부그룹번호</th>
                        <td id="ledgerGroupNo">${data.ledgerGroupNo}</td>
                        <th class="th">원부개별번호</th>
                        <td id="ledgerIndivNo">${data.ledgerIndivNo}</td>
                    </tr>
                    <tr>
                        <th class="th">차량관리번호</th>
                        <td id="vhmno">${data.vhmno}</td>
                        <th class="th">차량번호</th>
                        <td id="vhrno">${data.vhrno}</td>
                    </tr>
                    <tr>
                        <th class="th">차대번호</th>
                        <td id="vin">${data.vin}</td>
                        <th class="th">차종종별코드</th>
                        <td id="carmdlAsortCd">${data.carmdlAsortCd}</td>
                    </tr>
                    <tr>
                        <th class="th">차종종별명</th>
                        <td id="carmdlAsortNm">${data.carmdlAsortNm}</td>
                        <th class="th">차명</th>
                        <td id="atmbNm">${data.atmbNm}</td>
                    </tr>
                    <tr>
                        <th class="th">색상코드</th>
                        <td id="colorCd">${data.colorCd}</td>
                        <th class="th">색상명</th>
                        <td id="colorNm">${data.colorNm}</td>
                    </tr>
                    <tr>
                        <th class="th">번호판규격코드</th>
                        <td id="nopltSpcfctCd">${data.nopltSpcfctCd}</td>
                        <th class="th">번호판규격명</th>
                        <td id="nopltSpcfctNm">${data.nopltSpcfctNm}</td>
                    </tr>
                    <tr>
                        <th class="th">용도구분코드</th>
                        <td id="usgSeCd">${data.usgSeCd}</td>
                        <th class="th">용도구분명</th>
                        <td id="usgSeNm">${data.usgSeNm}</td>
                    </tr>
                    <tr>
                        <th class="th">원동기형식명</th>
                        <td id="mtrsFomNm">${data.mtrsFomNm}</td>
                        <th class="th">형식명</th>
                        <td id="fomNm">${data.fomNm}</td>
                    </tr>
                    <tr>
                        <th class="th">취득금액</th>
                        <td id="acqsAmt">${data.acqsAmt}</td>
                        <th class="th">등록상세코드</th>
                        <td id="regDtlCd">${data.regDtlCd}</td>
                    </tr>
                    <tr>
                        <th class="th">등록상세명</th>
                        <td id="regDtlNm">${data.regDtlNm}</td>
                        <th class="th">최초등록일</th>
                        <td id="frstRegYmd">${data.frstRegYmd}</td>
                    </tr>
                    <tr>
                        <th class="th">차령종료일</th>
                        <td id="veagEndYmd">${data.veagEndYmd}</td>
                        <th class="th">연식</th>
                        <td id="yridnw">${data.yridnw}</td>
                    </tr>
                    <tr>
                        <th class="th">제원관리번호1</th>
                        <td id="spmnno1">${data.spmnno1}</td>
                        <th class="th">제원관리번호2</th>
                        <td id="spmnno2">${data.spmnno2}</td>
                    </tr>
                    <tr>
                        <th class="th">제작년월일</th>
                        <td id="fbctnYmd">${data.fbctnYmd}</td>
                        <th class="th">주행거리</th>
                        <td id="drvngDstnc">${data.drvngDstnc}</td>
                    </tr>
                    <tr>
                        <th class="th">검사유효기간시작일</th>
                        <td id="inspVldPdBgngYmd">${data.inspVldPdBgngYmd}</td>
                        <th class="th">검사유효기간종료일</th>
                        <td id="inspVldPdEndYmd">${data.inspVldPdEndYmd}</td>
                    </tr>
                    <tr>
                        <th class="th">점검유효기간시작일</th>
                        <td id="chckVldPdBgngYmd">${data.chckVldPdBgngYmd}</td>
                        <th class="th">점검유효기간종료일</th>
                        <td id="chckVldPdEndYmd">${data.chckVldPdEndYmd}</td>
                    </tr>
                    <tr>
                        <th class="th">등록신청구분명</th>
                        <td id="regAplySeNm">${data.regAplySeNm}</td>
                        <th class="th">최초등록접수번호</th>
                        <td id="frstRegAplyRcptNo">${data.frstRegAplyRcptNo}</td>
                    </tr>
                    <tr>
                        <th class="th">번호판영치최고일</th>
                        <td id="nopltCsdyAvtsmtYmd">${data.nopltCsdyAvtsmtYmd}</td>
                        <th class="th">번호판영치여부</th>
                        <td id="nopltCsdyYn">${data.nopltCsdyYn}</td>
                    </tr>
                    <tr>
                        <th class="th">사업용사용기간</th>
                        <td id="bssUsePdYmd">${data.bssUsePdYmd}</td>
                        <th class="th">직권말소예고통지일</th>
                        <td id="octhtErsrPrvntcAvtsmtYmd">${data.octhtErsrPrvntcAvtsmtYmd}</td>
                    </tr>
                    <tr>
                        <th class="th">말소등록일</th>
                        <td id="ersrRegYmd">${data.ersrRegYmd}</td>
                        <th class="th">말소등록구분코드</th>
                        <td id="ersrRegSeCd">${data.ersrRegSeCd}</td>
                    </tr>
                    <tr>
                        <th class="th">말소등록구분명</th>
                        <td id="ersrRegSeNm">${data.ersrRegSeNm}</td>
                        <th class="th">저당수</th>
                        <td id="mrtgCnt">${data.mrtgCnt}</td>
                    </tr>
                    <tr>
                        <th class="th">압류건수</th>
                        <td id="szrCnt">${data.szrCnt}</td>
                        <th class="th">구조변경수</th>
                        <td id="strctChgCnt">${data.strctChgCnt}</td>
                    </tr>
                    <tr>
                        <th class="th">사용본거지주소</th>
                        <td id="usgsrhldAddr1">${data.usgsrhldAddr1}</td>
                        <th class="th">사용본거지주소상세</th>
                        <td id="usgsrhldAddrDtl1">${data.usgsrhldAddrDtl1}</td>
                    </tr>
                    <tr>
                        <th class="th">사용본거지행정동명</th>
                        <td id="usgsrhldDongNm">${data.usgsrhldDongNm}</td>
                        <th class="th">소유자주소</th>
                        <td id="ownrAddr">${data.ownrAddr}</td>
                    </tr>
                    <tr>
                        <th class="th">소유자주소상세</th>
                        <td id="ownrAddrDtl">${data.ownrAddrDtl}</td>
                        <th class="th">개인사업자여부</th>
                        <td id="indvdlBzmnYn">${data.indvdlBzmnYn}</td>
                    </tr>
                    <tr>
                        <th class="th">대표소유자전화번호</th>
                        <td id="rprsOwnrTelno">${data.rprsOwnrTelno}</td>
                        <th class="th">대표소유자성명</th>
                        <td id="rprsOwnrNm">${data.rprsOwnrNm}</td>
                    </tr>
                    <tr>
                        <th class="th">대표소유자회원구분코드</th>
                        <td id="rprsOwnrMbrSeCd">${data.rprsOwnrMbrSeCd}</td>
                        <th class="th">대표소유자회원번호</th>
                        <td id="rprsvOwnrIdecno">${data.rprsvOwnrIdecno}</td>
                    </tr>
                    <tr>
                        <th class="th">비과세대상구분코드</th>
                        <td id="taxxmptTrprSeCd">${data.taxxmptTrprSeCd}</td>
                        <th class="th">비과세대상구분코드명</th>
                        <td id="taxxmptAplcnSeCd">${data.taxxmptAplcnSeCd}</td>
                    </tr>
                    <tr>
                        <th class="th">특기사항건수</th>
                        <td id="spcablMttrCnt">${data.spcablMttrCnt}</td>
                        <th class="th">예고수</th>
                        <td id="prvntcCnt">${data.prvntcCnt}</td>
                    </tr>
                    <tr>
                        <th class="th">수출이행여부신고일</th>
                        <td id="xportFlflYnDclrYmd">${data.xportFlflYnDclrYmd}</td>
                        <th class="th">발급번호</th>
                        <td id="issuNo">${data.issuNo}</td>
                    </tr>
                    <tr>
                        <th class="th">최초양도일</th>
                        <td id="frstTrnsfrYmd">${data.frstTrnsfrYmd}</td>
                        <th class="th">구동축전지식별번호</th>
                        <td id="drivSrgbtryIdntfNo">${data.drivSrgbtryIdntfNo}</td>
                    </tr>
                    <tr>
                        <th class="th">처리불가사유코드</th>
                        <td id="prcsImprtyRsnCd">${data.prcsImprtyRsnCd}</td>
                        <th class="th">처리불가사유상세</th>
                        <td id="prcsImprtyRsnDtls">${data.prcsImprtyRsnDtls}</td>
                    </tr>
                </table>

                <!-- 등록원부 변경 이력 -->
                <c:if test="${not empty data.record}">
                    <h3 class="sub_tit" style="margin-top: 30px;">등록원부 변경 이력 (${fn:length(data.record)}건)</h3>
                    <table>
                        <colgroup>
                            <col style="width: 3%;" /><!-- 번호 -->
                            <col style="width: 3%;" /><!-- 해제여부 -->
                            <col style="width: 4%;" /><!-- 변경업무구분코드 -->
                            <col style="width: 9%;" /><!-- 변경업무구분명 -->
                            <col style="width: 3%;" /><!-- 주번호 -->
                            <col style="width: 3%;" /><!-- 부번호 -->
                            <col style="width: 6%;" /><!-- 변경일자 -->
                            <col style="width: 4%;" /><!-- 원부그룹번호 -->
                            <col style="width: 4%;" /><!-- 원부개별번호 -->
                            <col style="width: 9%;" /><!-- 접수번호 -->
                            <col style="width: 10%;" /><!-- 차량관리번호 -->
                            <col style="width: auto;" /><!-- 사항란 (가장 넓게) -->
                            <col style="width: 5%;" /><!-- 세대주명 -->
                            <col style="width: 7%;" /><!-- 세대주개인암호화번호 -->
                            <col style="width: 3%;" /><!-- 상세순번 -->
                            <col style="width: 3%;" /><!-- 표기여부 -->
                        </colgroup>
                        <thead>
                            <tr>
                                <th class="th">번호</th>
                                <th class="th">해제여부</th>
                                <th class="th">변경업무구분코드</th>
                                <th class="th">변경업무구분명</th>
                                <th class="th">주번호</th>
                                <th class="th">부번호</th>
                                <th class="th">변경일자</th>
                                <th class="th">원부그룹번호</th>
                                <th class="th">원부개별번호</th>
                                <th class="th">접수번호</th>
                                <th class="th">차량관리번호</th>
                                <th class="th">사항란</th>
                                <th class="th">세대주명</th>
                                <th class="th">세대주개인암호화번호</th>
                                <th class="th">상세순번</th>
                                <th class="th">표기여부</th>
                            </tr>
                        </thead>
                        <tbody>
                            <c:forEach var="rec" items="${data.record}" varStatus="status">
                                <tr>
                                    <td class="text-center">${status.count}</td>
                                    <td class="text-center">${rec.szrRmvDtlSn}</td>
                                    <td class="text-center">${rec.chgTaskSeCd}</td>
                                    <td class="text-center">${rec.chgTaskSeNm}</td>
                                    <td class="text-center">${rec.mainNo}</td>
                                    <td class="text-center">${rec.sno}</td>
                                    <td class="text-center">${rec.chgYmd}</td>
                                    <td class="text-center">${rec.ledgerGroupNo}</td>
                                    <td class="text-center">${rec.ledgerIndivNo}</td>
                                    <td class="text-center">${rec.aplyRcptNo}</td>
                                    <td class="text-center">${rec.vhmno}</td>
                                    <td class="text-left">${rec.spcablMttr}</td>
                                    <td class="text-center">${rec.hshldrNm}</td>
                                    <td class="text-center">${rec.hshldrIdecno}</td>
                                    <td class="text-center">${rec.dtlSn}</td>
                                    <td class="text-center">${rec.flag}</td>
                                </tr>
                            </c:forEach>
                        </tbody>
                    </table>
                </c:if>
            </div>
        </div>

        <!-- 팝업 버튼 -->
        <div class="popup_foot">
            <a href="#" class="newbtns bg2 modalclose">닫기</a>
        </div>
    </div>
</div>

<script type="text/javascript">
    (function(window, $) {
        'use strict';

        var LedgerInfoPopup = {
            /**
             * 이벤트 바인딩
             */
            bindEvents: function() {
                // 팝업 닫기
                $(".modalclose").on('click', function(e) {
                    e.preventDefault();
                    window.close();
                });
            },

            /**
             * 초기화
             */
            init: function() {
                this.bindEvents();
            }
        };

        // DOM 준비 완료 시 초기화
        $(document).ready(function() {
            LedgerInfoPopup.init();
        });

    })(window, jQuery);
</script>
