<?php
include_once "{$_SERVER['DOCUMENT_ROOT']}/common.inc.php";
?>

<!-- client editor popup <거래처 수정> -->

<!-- 거래처 수정 팝업 -->
<div id="popup_client_editor">
  <div class="awn-popup-confirm awn-form custom-popup free-height">
    <div class="awn-popup-search popup-form mb-block btn-ksmain-inject-block">

      <!-- form 시작 -->
      <form name="frmPartner" method="post">

        <!-- popup title -->
        <div class="title-container flexrow">
          <div class="awn-popup-title"><i class="bi bi-card-heading"></i> 거래처 등록</div>
        </div>

        <!-- form 내용 -->
        <div class="form-contents flexcol gap10">

          <!-- 인풋 및 셀렉트 -->
          <div class="form-box flexcol gap10">

            <div class="input-container flexrow gap03">
              <div class="input-box flex-2 flexrow">
                <label for="BP_CD">거래처코드</label>
                <input type="text" id="BP_CD" name="BP_CD" class="form-control form-control-sm" readonly />
              </div>
              <div class="input-box flex-1 flexrow">
                <p class="input-title">자사구분</p>
                <label class="form_toggle" style="width:auto;">
                  <input type="checkbox" id="BP_TYPE" name="BP_TYPE" value="Y">
                </label>
              </div>
              <div class="input-box flex-1 flexrow">
                <p class="input-title">사용</p>
                <label class="form_toggle" style="width:auto;">
                  <input type="checkbox" id="USE_FLG" name="USE_FLG" checked value="Y">
                </label>
              </div>
            </div>


            <div class="input-container flexrow gap06">

              <div class="input-box flex-1 flexrow">
                <label for="">거래처</label>
                <input type="text" id="BP_NM" name="BP_NM" class="form-control form-control-sm" />
              </div>
              <div class="input-box flex-1 flexrow">
                <label for="">거래처상세명칭</label>
                <input type="text" id="BP_FULL_NM" name="BP_FULL_NM" />
              </div>
            </div>


            <div class="input-container flexrow gap06">
              <div class="input-box flex-1 flexrow">
                <label for="">대표자명</label>
                <input type="text" id="REPRESN_NM" name="REPRESN_NM" />
              </div>
              <div class="input-box flex-1 flexrow">
                <label for="">사업자등록번호</label>
                <input type="text" id="BIZ_REG_NO" name="BIZ_REG_NO" oninput="formatBusinessRegistrationNumber(this)"
                  maxlength="12" />
              </div>
            </div>

            <div class="input-container flexrow gap06">
              <div class="input-box flex-1 flexrow">
                <label for="">업종</label>
                <input type="text" id="BIZ_TYPE" name="BIZ_TYPE" />
              </div>
              <div class="input-box flex-1 flexrow">
                <label for="">업태</label>
                <input type="text" id="BIZ_ITEM" name="BIZ_ITEM" />
              </div>
            </div>

            <div class="input-container flexrow gap06">
              <div class="input-box flex-1 flexrow">
                <label for="">우편번호</label>
                <input type="text" id="ZIP_CD" name="ZIP_CD" data-zipcode="#ZIP_CD" data-address="#ADDR1"
                  style="width: calc(50% - 123px);" />
                <button type="button" class="btn btn-sm btn-success btnFindAddr" data-zipcode="#ZIP_CD"
                  data-address="#ADDR1" style="margin-left:10px;">Zipcode</button>
              </div>
              <div class="input-box flex-1 flexrow">
                <label for="">주소</label>
                <input type="text" id="ADDR1" name="ADDR1" />
              </div>
            </div>

            <div class="input-container flexrow">
              <div class="input-box flexrow">
                <label for="">상세주소</label>
                <input type="text" id="ADDR2" name="ADDR2" />
              </div>
            </div>

            <div class="input-container flexrow gap06">
              <div class="input-box flex-1 flexrow">
                <label for="NAT_CD">국가</label>
                <select id="NAT_CD" name="NAT_CD" class="form-control-sm form-select">
                  <?= getSelectOptions($GLOBALS['_varsNations'], $emptv = "- " . cUtil\Mlang::getText("선택") . " -") ?>
                </select>
              </div>
              <div class="input-box flex-1 flexrow">
                <label for="CURRENCY_CD">거래화폐</label>
                <select id="CURRENCY_CD" name="CURRENCY_CD" class="form-control-sm form-select">
                  <?= getSelectOptionsExp($GLOBALS['_varsCurrencyExp'], $emptv = "- " . cUtil\Mlang::getText("선택") . " -") ?>
                </select>
              </div>
            </div>

            <div class="input-container flexrow gap06">
              <div class="input-box flex-1 flexrow">
                <label for="">전화</label>
                <input type="text" id="TEL_NO" name="TEL_NO" oninput="localAutoHyphen(this)" maxlength="13" />
              </div>
              <div class="input-box flex-1 flexrow">
                <label for="">팩스</label>
                <input type="text" id="FAX_NO" name="FAX_NO" oninput="localAutoHyphen(this)" maxlength="13" />
              </div>
            </div>

            <div class="input-container flexrow">
              <div class="input-box">
                <label for="">거래구분</label>
                <div class="check-label">
                  <label for="PUR_FLG">
                    매입처
                  </label>
                  <input type="checkbox" id="PUR_FLG" name="PUR_FLG">
                </div>
                <div class="check-label">
                  <label for="SAL_FLG">
                    매출처
                  </label>
                  <input type="checkbox" id="SAL_FLG" name="SAL_FLG">
                </div>

              </div>
            </div>

            <input type="text" id="RES_REG_NO" name="RES_REG_NO" style="display: none" />

            <div class="input-container flexrow">
              <div class="input-box flexrow">
                <label for="">비고</label>
                <textarea id="REMK" name="REMK" style="resize:none; height: 60px;"></textarea>
              </div>
            </div>

          </div>


          <!-- 테이블 박스 -->
          <div class="table-box" id="modal_table">
            <!-- 테이블 헤더 (제목, 추가, 삭제, 저장) -->
            <div class="table-title">
              <p class="title">
                거래처 담당자
              </p>

              <!-- 버튼 -->
              <div class="button-box">
                <div class="add-btn reverse-btn">
                  <?php include _SVC_INC_PATH_ . '/img/add.php' ?>
                  추가
                </div>
                <div class="remove-btn reverse-btn">
                  <?php include _SVC_INC_PATH_ . '/img/delete.php' ?>
                  삭제
                </div>
              </div>
              <!-- 버튼 종료 // -->

            </div>
            <!-- 테이블 헤더 종료 // -->

            <!-- 테이블 -->
            <div style="height: calc(100% - 45px);">
              <div id="tbl_partner_member" class="hy-table"></div>
            </div>
            <!-- 테이블 종료 // -->

          </div>
          <!-- 테이블 박스 종료 //-->

        </div>
        <!-- form-contents 종료 -->
        <div class="button-box flexfillend" style="height:40px">
          <button class="basic-btn">저 장</button>
        </div>

      </form>
    </div>
  </div>
</div>