<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">

<div class="modal-header">
<h5 class="modal-title">보안분실운영 현황</h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
	<ul class="nav nav-tabs" id="userTab" role="tablist">
        <li class="nav-item" role="presentation">
          <button class="nav-link active" id="accessTab" data-bs-toggle="tab" data-bs-target="#accessTabPanel" type="button" role="tab" aria-controls="accessTabPanel" aria-selected="true">현황상세</button>
        </li>
        <li class="nav-item" role="presentation">
          <button class="nav-link" id="approvalTab" th:onclick="|showHistory(${partInfo.piSeq})|" data-bs-toggle="tab" data-bs-target="#approvalTabPanel" type="button" role="tab" aria-controls="approvalTabPanel" aria-selected="false">수정이력</button>
        </li>
   </ul>
  <form id="partInfoUpdate" method="post">
        <input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
   		<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
   		<input type="hidden" name="piSeq" th:value="${partInfo.piSeq}">
   		<input type="hidden" name="versionNo" th:value="${partInfo.versionNo}">
          <div class="mb-2 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">해경서</label>        
            <div class="col-sm-3">
               <select class="form-select form-select-sm" id="mMgtOrgan" name="mgtOrgan" th:disabled="${accessAuth ne 'ACC003'}">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('OG')}">
                    <th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
                      <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq partInfo.mgtOrgan}"></option>
                    </th:block>
                  </th:block>
               </select>
            </div>
           <label for="ofcCd" class="col-sm-2 col-form-label text-center">육경서</label>
            <div class="col-sm-3">
              <input type="text" class="form-control" id="landPolice" name="landPolice" th:value="${partInfo.landPolice}" placeholder="직접입력">
            </div> 
          </div>
          <div class="mb-2 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">담당자</label>        
            <div class="col-sm-3">
               <select class="form-select form-select-sm" id="mPiUserSeq" name="piUserSeq">
                  <option value="">-선택-</option>
		          <th:block th:each="info:${managerList}">
		             <option th:value="${info.user_seq}" th:text="${info.user_name}" th:selected="${info.user_seq eq partInfo.piUserSeq}"></option>
		          </th:block>
               </select>
            </div>
          </div>
          <div class="mb-3 row">
			<label for="ogCd" class="col-sm-2 col-form-label text-center">터미널명</label>
			<div class="col-sm-4">
			    <input type="text" class="form-control" id="mTerminalNm" name="terminalNm" th:value="${partInfo.terminalNm}" placeholder="직접입력">
            </div>
          </div>
          <br><br>
          <h6>해경</h6>
          <div class="mb-3 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">근무방법</label>
            <div class="col-sm-2">
               <select class="form-select form-select-sm" id="mMpWorkType" name="mpWorkType">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('PIS')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq partInfo.mpWorkType}"></option>
                  </th:block>
               </select>
            </div>
            <label for="ofcCd" class="col-sm-2 col-form-label text-center">인원수</label>
            <div class="col-sm-2">
              <input type="number" class="form-control" id="mMpPeopleCnt" name="mpPeopleCnt" th:value="${partInfo.mpPeopleCnt}">
            </div>
           <label for="ofcCd" class="col-sm-1 col-form-label text-center">비고</label>
            <div class="col-sm-3">
              <input type="text" class="form-control" id="mpDescription" name="mpDescription" th:value="${partInfo.mpDescription}">
            </div> 
          </div>
          <h6>육경</h6>
          <div class="mb-3 row">
            <label for="ogCd" class="col-sm-2 col-form-label text-center">근무방법</label>
            <div class="col-sm-2">
               <select class="form-select form-select-sm" id="mPlWorkType" name="plWorkType">
                  <option value="">선택</option>
                  <th:block th:each="commonCode:${session.commonCode.get('PIS')}">
                    <option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq partInfo.plWorkType}"></option>
                  </th:block>
               </select>
            </div>
            <label for="ofcCd" class="col-sm-2 col-form-label text-center">인원수</label>
            <div class="col-sm-2">
              <input type="number" class="form-control" id="mPlPeopleCnt" name="plPeopleCnt" th:value="${partInfo.plPeopleCnt}">
            </div>
           <label for="ofcCd" class="col-sm-1 col-form-label text-center">비고</label>
            <div class="col-sm-3">
              <input type="text" class="form-control" id="plDescription" name="plDescription" th:value="${partInfo.plDescription}">
            </div> 
          </div>
          <br><br>
          <div class="mb-3 row">
          <label for="ofcCd" class="col-sm-2 col-form-label text-center">임차료</label>
            <div class="col-sm-2">
              <select class="form-select form-select-sm" id="mRentType" name="rentType">
                  <option value="">선택</option>
                  <option value="N" th:selected="${'N' eq partInfo.rentType}">무상</option>
                  <option value="Y" th:selected="${'Y' eq partInfo.rentType}">유상</option>
               </select>       
            </div>
            <div class="col-sm-3">
            	<input type="number" class="form-control" id="mRentPrice" name="rentPrice" th:value="${partInfo.rentPrice}" placeholder="단위: 만">
            </div>
          </div>
          <div class="mb-3 row">
          <label for="ofcCd" class="col-sm-2 col-form-label text-center">공공요금</label>
            <div class="col-sm-2">
              <select class="form-select form-select-sm" id="mUtilityType" name="utilityType">
                  <option value="">선택</option>
                  <option value="N" th:selected="${'N' eq partInfo.utilityType}">무상</option>
                  <option value="Y" th:selected="${'Y' eq partInfo.utilityType}">유상</option>
               </select>       
            </div>
            <div class="col-sm-3">
            	<input type="number" class="form-control" id="mUtilityPrice" name="utilityPrice" th:value="${partInfo.utilityPrice}" placeholder="단위: 만">
            </div>
          </div>
          <div class="row mb-3">
	      <label for="fileInputer" class="col-sm-2 col-form-label text-center">업로드 자료</label>
	      <div class="col-sm-10" style="min-height: 70px;">
	        <div class="w-100 h-100 border border-info rounded text-center" id="uploadDiv">
	          <th:block th:if="${#strings.isEmpty(partInfo.fileList[0].origNm)}">
	            <br>파일을 업로드 해주세요.
	          </th:block>
	          <th:block th:unless="${#strings.isEmpty(partInfo.fileList[0].origNm)}">
	            <div class='row-col-6' th:each="infoFile:${partInfo.fileList}">
	              <span th:data-fileseq="${infoFile.fileSeq}" th:text="|${infoFile.origNm}.${infoFile.fileExtn} ${infoFile.fileSize}|"></span>
	              <a href='#' class='fileDownPartInfo text-decoration-none' th:data-fileSeq="${infoFile.fileSeq}" th:data-piSeq="${infoFile.piSeq}" th:data-verNo="${infoFile.versionNo}">다운</a>
	              <a href='#' class='uploadedFileDelete text-danger text-decoration-none'>삭제</a>
	            </div>
	          </th:block>
	        </div>
	      </div>
	      <input type="file" class="d-none" id="fileInputer" multiple>
	    </div>

      </form>
</div>
<div class="modal-footer justify-content-between">
  <div class="col-auto">
    <button type="button" class="btn btn-secondary" id="btn-close" data-bs-dismiss="modal">닫기</button>
    <button type="button" class="btn btn-danger" id="deletePartInfo" th:if="${accessAuth eq 'ACC003'} or ${wrtId eq userId}">삭제</button>
    <button type="button" class="btn btn-primary" id="updatePartInfo" th:if="${accessAuth eq 'ACC003'} or ${wrtId eq userId}">수정</button>
  </div>
</div>
</html>