<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
    xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>메이드유 CRM</title>

    <!-- jQuery -->
    <script src="/js/web/jquery.min.js"></script>
    <script src="/js/web/jquery-ui.js"></script>

    <!-- Choices.js -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/choices.min.css">
    <script src="https://cdn.jsdelivr.net/npm/choices.js/public/assets/scripts/choices.min.js"></script>

    <!-- Flatpickr -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
    <script src="https://cdn.jsdelivr.net/npm/flatpickr"></script>
    <script src="https://cdn.jsdelivr.net/npm/flatpickr/dist/l10n/ko.js"></script>

    <!-- CSS -->
    <link rel="stylesheet" href="/css/web/font.css">
    <link rel="stylesheet" href="/css/kiosk/new-patient.css">
</head>

<th:block layout:fragment="layout_top_script">
    <script src="/js/kiosk/new-patient.js"></script>
</th:block>
<!--<th:block th:replace="/web/include/modal :: layout_modal"></th:block>-->

<th:block layout:fragment="layout_content">
    <div id="newPatientForm" class="new-patient-container">

        <!-- Header -->
        <header class="page-header">
            <h1 class="title">신규 고객 등록</h1>
        </header>

        <!-- Body -->
        <main class="page-body">
            <div class="form-grid-layout">

                <!-- Column 1: Basic Info -->
                <section class="form-section-card col-card">
                    <div class="section-title">기본 정보</div>

                    <!-- Nationality -->
                    <div class="form-row">
                        <label class="required">국적</label>
                        <select id="selectNationality" name="nationality">
                            <option value="">국적 선택</option>
                        </select>
                    </div>

                    <!-- Name -->
                    <div class="form-row">
                        <label class="required">고객명</label>
                        <input type="text" name="modalUserName" placeholder="이름을 입력하세요" />
                    </div>

                    <!-- Birthday -->
                    <div class="form-row">
                        <label>생년월일</label>
                        <div class="date-input-wrapper">
                            <input name="modalBirthday" type="text" placeholder="YYYY-MM-DD" readonly />
                            <span class="age-text txtAge"></span>
                            <img src="/image/web/calendar.svg" alt="calendar">
                        </div>
                    </div>

                    <!-- Gender -->
                    <div class="form-row">
                        <label>성별</label>
                        <div class="radio-group">
                            <div class="radio-item">
                                <input type="radio" name="modalGender" id="genderF" value="F" />
                                <label for="genderF">여자</label>
                            </div>
                            <div class="radio-item">
                                <input type="radio" name="modalGender" id="genderM" value="M" />
                                <label for="genderM">남자</label>
                            </div>
                        </div>
                    </div>

                    <!-- Identification (Dynamic) -->
                    <div class="form-row foreigner_box">
                        <label>식별정보</label>
                        <select id="selectIdentification" name="identificationType">
                            <option value="pno" selected>여권번호</option>
                            <option value="arc">외국인등록번호</option>
                        </select>
                        <div class="passport_number_box">
                            <input name="modalUserPno" type="text" placeholder="여권번호 입력" />
                        </div>
                        <div class="foreigner_number_box split-inputs" style="display:none;">
                            <input name="modalUserArc1" type="text" placeholder="000000" maxlength="6" />
                            <span class="split-divider">-</span>
                            <input name="modalUserArc2" type="password" placeholder="0000000" maxlength="7" />
                        </div>
                    </div>

                    <div class="form-row local_box">
                        <label>주민등록번호</label>
                        <div class="split-inputs">
                            <input name="modalUserRrn1" type="text" placeholder="000000" maxlength="6" />
                            <span class="split-divider">-</span>
                            <input name="modalUserRrn2" type="password" placeholder="0000000" maxlength="7" />
                        </div>
                    </div>
                </section>

                <!-- Column 2: Contact Info -->
                <section class="form-section-card col-card">
                    <div class="section-title">연락처 및 동의</div>

                    <!-- User Type -->
                    <div class="form-row">
                        <label>고객구분</label>
                        <select id="selectUserType" name="userType">
                            <option value="">고객구분 선택</option>
                        </select>
                    </div>

                    <!-- Phone 1 -->
                    <div class="form-row">
                        <label class="required">연락처</label>
                        <input name="modalPhoneNumber" type="tel" placeholder="010-0000-0000" />
                    </div>

                    <!-- Phone 2 -->
                    <div class="form-row">
                        <label>보조 연락처</label>
                        <input name="modalPhoneNumber2" type="tel" placeholder="010-0000-0000" />
                    </div>

                    <!-- Photo Refusal -->
                    <div class="form-row">
                        <label>사진 거부</label>
                        <div class="radio-group">
                            <div class="radio-item">
                                <input type="radio" name="modalRefusePhotoYn" id="photoY" value="Y" checked />
                                <label for="photoY">예</label>
                            </div>
                            <div class="radio-item">
                                <input type="radio" name="modalRefusePhotoYn" id="photoN" value="N" />
                                <label for="photoN">아니오</label>
                            </div>
                        </div>
                    </div>

                    <!-- SMS -->
                    <div class="form-row">
                        <label>SMS 수신여부</label>
                        <div class="radio-group">
                            <div class="radio-item">
                                <input type="radio" name="modalSmsYn" id="smsY" value="Y" checked />
                                <label for="smsY">예</label>
                            </div>
                            <div class="radio-item">
                                <input type="radio" name="modalSmsYn" id="smsN" value="N" />
                                <label for="smsN">아니오</label>
                            </div>
                        </div>
                    </div>
                </section>

                <!-- Column 3: Additional Info -->
                <section class="form-section-card col-card">
                    <div class="section-title">기타 정보</div>

                    <!-- Treatment -->
                    <div class="form-row">
                        <label>관심진료</label>
                        <select id="selectTreatment" name="treatment">
                            <option value="">관심진료 선택</option>
                        </select>
                    </div>

                    <!-- Channel -->
                    <div class="form-row">
                        <label>방문경로</label>
                        <select id="selectChannel" name="channel">
                            <option value="">방문경로 선택</option>
                        </select>
                    </div>

                    <!-- Recommender -->
                    <div class="form-row">
                        <label>추천인</label>
                        <div class="searchIntroUser" style="position:relative; cursor:pointer;">
                            <input type="text" name="modalRecommendId" placeholder="검색하여 선택하세요" readonly
                                style="cursor:pointer; padding-right:40px;" />
                            <img src="/image/web/search_B.svg" alt="search"
                                style="position:absolute; right:12px; top:50%; transform:translateY(-50%); width:18px;">
                        </div>
                    </div>

                    <!-- Etc -->
                    <div class="form-row">
                        <label>특이 사항 (시술/약물)</label>
                        <textarea name="modalEtc" placeholder="특이사항을 입력하세요"></textarea>
                    </div>

                    <!-- Memo -->
                    <div class="form-row">
                        <label>고객 메모</label>
                        <textarea name="modalMemo" placeholder="메모를 입력하세요"></textarea>
                    </div>
                </section>

            </div>
        </main>

        <!-- Footer -->
        <footer class="page-footer">
            <!-- Use project standard classes -->
            <button type="button" class="cancel_btn btnCancle">취소</button>
            <button type="button" class="registration_bth btnSave">등록 완료</button>
        </footer>

    </div>
</th:block>

<th:block layout:fragment="layout_script">
    
</th:block>

</html>