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

<div class="modal-header">
  <h5 class="modal-title" id="menuEditModalLabel" th:text="${info.phoneKey eq null?'업무용 휴대전화 등록':'업무용 휴대전화 수정'}"></h5>
  <th:block th:if="${info.phoneKey eq null}">
  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  </th:block>
  <th:block th:unless="${info.phoneKey eq null}">
  <button type="button" class="btn-close" id="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
  </th:block>
</div>
<div class="modal-body">
  <form id="cellPhoneEditFm" 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="phoneKey" th:value="${info.phoneKey}">
    <input type="hidden" name="wrtOrgan" th:value="${info.wrtOrgan}">
    <input type="hidden" name="wrtPart" th:value="${info.wrtPart}">
    <input type="hidden" name="wrtTitle" th:value="${info.wrtTitle}">
    <input type="hidden" name="wrtUserSeq" th:value="${info.wrtUserSeq}">
    <input type="hidden" name="wrtNm" th:value="${info.wrtNm}">
    <div class="row mb-3">
      <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">관리처</label>
      <div class="col-sm-6">
        <select class="form-select form-select-sm" id="mgtOrgan" 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)}">
              <th:block th:if="${info.phoneKey eq null}">
              	<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq userOrgan}"></option>
              </th:block>
              <th:block th:unless="${info.phoneKey eq null}">
              	<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq info.mgtOrgan}"></option>
              </th:block>
            </th:block>
          </th:block>
        </select>
      </div>
    </div>
    <div class="mb-3 row">
      <label for="ogCd" class="col-sm-4 col-form-label text-center">사용자</label>        
      <div class="col-sm-6">
         <select class="form-select form-select-sm" id="pUserSeq" name="pUserSeq">
            <option value="">선택</option>
            <th:block th:unless="${info.phoneKey eq null}">
	            <th:block th:each="uInfo:${managerList}">
			       <option th:value="${uInfo.user_seq}" th:text="|${uInfo.title_cd} ${uInfo.user_nm}|" th:selected="${uInfo.user_seq eq info.pUserSeq}"></option>
			    </th:block>
			</th:block>
         </select>
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat1Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">전화번호</label>
      <div class="col-sm-6">
        <input type="text" class="form-control" id="telNo" name="telNo" th:value="${info.telNo}" placeholder="EX: 010-0000-0000">
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">등록외부메일</label>
      <div class="col-sm-6">
        <input type="text" class="form-control" id="extMail" name="extMail" th:value="${info.extMail}" placeholder="EX: test@test.com">
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">웹엑스<br>미팅번호</label>
      <div class="col-sm-6">
        <input type="text" class="form-control" id="webexNo" name="webexNo" th:value="${info.webexNo}">
      </div>
    </div>
     <div class="row mb-3">
      <label for="cat2Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">카카오톡 ID</label>
      <div class="col-sm-6">
        <input type="text" class="form-control" id="katalkId" name="katalkId" th:value="${info.katalkId}">
      </div>
    </div>
    <div class="row mb-3">
      <label for="cat3Cd" class="col-sm-4 col-form-label col-form-label-sm text-center">비고</label>
      <div class="col-sm-6">
        <input type="text" class="form-control" id="description" name="description" th:value="${info.description}">
      </div>
    </div>
  </form>
</div>
<div class="modal-footer justify-content-between">
	<div class="col-auto">
		<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
	<th:block th:if="${info.phoneKey != null}">
		<button type="button" class="btn btn-danger" id="deleteCellPhoneM"th:if="${accessAuth eq 'ACC003'} or ${info.wrtUserSeq eq userSeq}">삭제</button>
	</th:block>
	</div>
	<div class="col-auto">
		<button type="button" class="btn btn-primary" id="saveCellPhone" th:if="${info.phoneKey eq null}">저장</button>
	<th:block th:if="${info.phoneKey != null}">
		<button type="button" class="btn btn-warning" id="updateCellPhone" th:if="${accessAuth eq 'ACC003'} or ${info.wrtUserSeq eq userSeq}">수정</button>	
	</th:block>
	</div>
</div>
</html>