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

<div class="modal-header">
  <h5 class="modal-title" id="menuEditModalLabel">외사분실 실적 상세</h5>
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
  <form action="#" method="post" id="partWorkUpdateFm">
    <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="pwSeq" th:value="${pwInfo.pwSeq}">
    <input type="hidden" id="mPiSeq" name="piSeq" th:value="${pwInfo.piSeq}">
    <div class="mb-3 row">
      <label for="wrtUserNm" class="col-sm-2 col-form-label text-center">터미널명</label>
      <div class="col-sm-4">
      	<input type="hidden" class="form-control" th:value="${pwInfo.piSeq}" name="piSeq" readonly>
      	<input type="text" class="form-control" th:value="${pwInfo.terminalNm}" readonly>
      </div>
      <label for="wrtDt" class="col-sm-2 col-form-label text-center">일시</label>
      <div class="col-sm-4">
        <input type="text" class="form-control" id="mWorkDt" name="workDt" th:value="${pwInfo.workDt}" readonly>
      </div>
    </div>
    <div class="mb-3 row">
      <label for="title" class="col-sm-2 col-form-label text-center">작성자</label>
      <div class="col-sm-4">
        <input type="text" class="form-control" th:value="|${pwInfo.wrtTitle} ${pwInfo.wrtNm}|" readonly>
      </div>
      <label for="wrtDt" class="col-sm-2 col-form-label text-center">최종수정일</label>
      <div class="col-sm-4">
        <input type="text" class="form-control" th:value="${#temporals.format(pwInfo.wrtDt, 'yyyy-MM-dd HH:mm')}" readonly>
      </div>
    </div>
    <br>
    <div class="mb-3 row justify-content-center">
    <label class="col-sm-2 col-form-label text-center">종류</label>
            <div class="col-sm-12">
            <label for="workType" class="col-sm-2 col-form-label text-center">사건처리</label>	
            	<input type="radio" name="workType" value="CH" th:checked="${pwInfo.workType eq 'CH'}">
            <label for="workType" class="col-sm-2 col-form-label text-center">범죄첩보제공</label>	
               <input type="radio" name="workType" value="POCI" th:checked="${pwInfo.workType eq 'POCI'}">
            <label for="workType" class="col-sm-1 col-form-label text-center">SRI</label>	
               <input type="radio" name="workType" value="SRI" th:checked="${pwInfo.workType eq 'SRI'}"> 
            <label for="workType" class="col-sm-2 col-form-label  text-center">합동점검</label>	
               <input type="radio" name="workType" value="JI" th:checked="${pwInfo.workType eq 'JI'}">
            <label for="workType" class="col-sm-1 col-form-label text-center">회의</label>	
               <input type="radio" name="workType" value="MT" th:checked="${pwInfo.workType eq 'MT'}">
            <label for="workType" class="col-sm-1 col-form-label text-center">기타</label>	
               <input type="radio" name="workType" value="ETC" th:checked="${pwInfo.workType eq 'ETC'}">
            </div>
          </div>
    <div class="mb-3 row justify-content-center">
      <label for="workInfo" class="col-sm-2 col-form-label text-center">내용</label>
      <div class="col-sm-10">
        <textarea id="mWorkInfo" name='workInfo' th:utext="${pwInfo.workInfo}"></textarea>
      </div>
    </div>
    <div class="mb-3 row">
      <label for="title" class="col-sm-2 col-form-label text-center">비고</label>
      <div class="col-sm-10">
        <input type="text" class="form-control" id="mDescription" name="description" th:value="${pwInfo.description}">
      </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="${#arrays.isEmpty(pwInfo.fileList)}">
	            <br>파일을 업로드 해주세요.
	          </th:block>
	          <th:block th:unless="${#arrays.isEmpty(pwInfo.fileList)}">
	            <div class='row-col-6' th:each="infoFile:${pwInfo.fileList}">
	              <span th:data-fileseq="${infoFile.fileSeq}" th:text="|${infoFile.origNm}.${infoFile.fileExtn} ${infoFile.fileSize}|"></span>
	              <a href='#' class='fileDownPartWork text-decoration-none' th:data-fileSeq="${infoFile.fileSeq}" th:data-pwSeq="${infoFile.pwSeq}" th:data-piSeq="${infoFile.piSeq}">다운</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>
  <th:block th:if="${userId eq pwInfo.wrtNm} or ${accessAuth eq 'ACC003'}">
  <button type="button" class="btn btn-danger" id="deletePartWork">삭제</button>
  </th:block>
  </div>
  <th:block th:if="${userId eq pwInfo.wrtNm} or ${accessAuth eq 'ACC003'}"><!--작성자 관리자일 경우 수정 허용-->
  <button type="button" class="btn btn-warning" id="updateBtn">수정</button>
  </th:block>
</div>
</html>