<%@ 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="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<script>
  field_data = JSON.parse('${fieldDataVO.field_data}');
</script>
<div class="section_content">
  <div class="row justify-content-end bg-white mx-3 py-2">
    <h5><i class="bi bi-dot"></i> 작성자 정보</h5>
    <div class="col-4">
      <div class="row mb-3">
        <label for="company" class="col-4 col-form-label fw-bold text-end">소속</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="company" placeholder="col-form-label" value="${userVO.company}" readonly>
        </div>
        <label for="name" class="col-4 col-form-label fw-bold text-end">이름</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="name" placeholder="col-form-label" value="${userVO.name}" readonly>
        </div>
        <label for="phonenum" class="col-4 col-form-label fw-bold text-end">연락처</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="phonenum" placeholder="col-form-label" value="${userVO.phonenum}" readonly>
        </div>
      </div>
      <div class="row mb-3">
        <h5><i class="bi bi-dot"></i> 지도 정보</h5>
        <label for="layer_id" class="col-4 col-form-label fw-bold text-end">레이어 ID</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="layer_id" placeholder="col-form-label" value="${fieldDataVO.layer_id}" readonly>
        </div>
        <label for="save_date" class="col-4 col-form-label fw-bold text-end">수집일</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="save_date" placeholder="col-form-label" value="${fieldDataVO.save_date}" readonly>
        </div>
        <label for="region" class="col-4 col-form-label fw-bold text-end">지역</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="region" placeholder="col-form-label" value="${fieldDataVO.region}" readonly>
        </div>
        <label class="col-4 col-form-label fw-bold text-end">상태</label>
        <div class="col-8 my-auto">
          <c:choose>
            <c:when test="${fieldDataVO.status eq '0'}">
              <span class="card-warning ms-2 w-50 text-center">수집</span>
            </c:when>
            <c:when test="${fieldDataVO.status eq '1'}">
              <span class="card-danger ms-2 w-50 text-center">검증실패</span>
            </c:when>
            <c:when test="${fieldDataVO.status eq '2'}">
              <span class="card-success ms-2 w-50 text-center">검증성공</span>
            </c:when>
            <c:when test="${fieldDataVO.status eq '3'}">
              <span class="card-danger ms-2 w-50 text-center">반영실패</span>
            </c:when>
            <c:when test="${fieldDataVO.status eq '4'}">
              <span class="card-success ms-2 w-50 text-center">반영</span>
            </c:when>
          </c:choose>
        </div>
        <label for="description" class="col-4 col-form-label fw-bold text-end">설명</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="description" readonly>
        </div>
        <label for="errInfo" class="col-4 col-form-label fw-bold text-end">오류내용</label>
        <div class="col-8">
          <input type="text" class="form-control bg-white border-0" id="errInfo" readonly>
        </div>
      </div>
    </div>
    <div class="col-8">
      <ul class="nav nav-tabs" id="myTab" role="tablist">
        <li class="nav-item" role="presentation">
          <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">측량데이터</button>
        </li>
        <li class="nav-item" role="presentation">
          <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">속성정보</button>
        </li>
      </ul>
      <div class="tab-content" id="myTabContent">
        <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
          <div class="map" id="map">

          </div>
        </div>
        <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">
          <table class="fieldDataTable" id="fieldDataTable">
            <tbody id="fieldDataBody">

            </tbody>
          </table>
        </div>
      </div>
      <ul id="fieldDataPaging" class="fieldDataPaging"></ul>
    </div>
  </div>
  <div class="section_btn">
    <p class="search_p1">
      <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
    </p>
    <p class="search_p2">
      <input class="btn btn-secondary" type="button" value="표준DB변환 및 검증" onclick="fieldVerify();"/>
      <input class="btn btn-success" type="button" value="반영" onclick="fieldReflect();"/>
    </p>
  </div>
</div>