<div class="page-breadcrumbs">
    <ul class="breadcrumb">
        <li>
            <i class="fa fa-home"></i>
            <a href="#" style="color: #797979">主頁</a>
        </li>

        <li class='active' style='color:#ef4130'>學生</li>
    </ul>
</div>

<div class="page-header position-relative">
    <div class="header-title">
        <h1>
            學生管理
        </h1>
    </div>
    <!--Header Buttons-->
    <div class="header-buttons">
        <a class="sidebar-toggler" href="#">
            <i class="glyphicon glyphicon-resize-horizontal"></i>
        </a>
        <a class="refresh" id="refresh-toggler" href="#">
            <i class="glyphicon glyphicon-refresh"></i>
        </a>
        <a class="fullscreen" id="fullscreen-toggler" href="#">
            <i class="glyphicon glyphicon-fullscreen"></i>
        </a>
    </div>
    <!--Header Buttons End-->
</div>

<div class="content">
    <div class="row">
        <div class="col-md-6">
            <table class="partial_form_table">
                <form method="post" action="/backend/student/update">
                    <tr>
                        <td class="partial_form_label">
                            <label>學員編號</label>
                        </td>
                        <td>
                            <input type="text" class="form-control" id="student_id" name="student_no" placeholder="請填寫學員編號" value="<?= $student_no ?>">
                        </td>
                    </tr>
                    <tr>
                        <td class="partial_form_label">
                            <label>中文姓名</label>
                        </td>
                        <td>
                            <input type="text" class="form-control" id="chi_name" name="chi_name" placeholder="請填寫中文姓名" value="<?= $chi_name ?>">
                        </td>
                    </tr>
                    <tr>
                        <td class="partial_form_label">
                            <label>英文姓名</label>
                        </td>
                        <td>
                            <input type="text" class="form-control" id="eng_name" name="eng_name" placeholder="請填寫英文姓名" value="<?= $eng_name ?>">
                        </td>
                    </tr>
                    <tr>
                        <td class="partial_form_label">
                            <label>性別</label>
                        </td>
                        <td>
                            <select id="gender" name="gender">
                                <?php if ($gender == "1") { ?>
                                    <option value="0">請選擇性別</option>
                                    <option selected value="1">男</option>
                                    <option value="2">女</option>
                                <?php } else { ?>
                                    <option value="0">請選擇性別</otpion>
                                    <option value='1'>男</option>
                                    <option selected value="2">女</option>
                                <?php } ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="partial_form_label">
                            <label>出生日期</label>
                        </td>
                        <td>
                            <input type="date" class="form-control" id="dob" name="dob" placeholder="請選擇出生日期" value="<?= $dob ?>">
                        </td>
                    </tr>
                    <tr>
                        <td class="partial_form_label">
                            <label>推薦人</label>
                        </td>
                        <td>
                            <input type="text" class="form-control" id="recommand" name="recommand" placeholder="請填寫推薦人" value="<?= $recommand ?>">
                        </td>
                    </tr>
                    <tr>
                        <td class="partial_form_label">
                            <label>備註</label>
                        </td>
                        <td>
                            <input type="text" class="form-control" id="remark" name="remark" placeholder="請填寫推備註" value="<?= $remark ?>">
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <input type="hidden" name="id" id="id" value="<?= $id ?>">
                        <td><button type="submit" class="btn btn-default submit">確認</button></td>
                    </tr>




            </table>
        </div>
        <div class="col-md-6">
            <table class="partial_form_table">

                <tr>
                    <td class="partial_form_label red_label"><label>主聯絡人</label></td>
                    <td style="vertical-align:bottom;" colspan="3">
                        <hr>
                    </td>
                </tr>
                <tr>
                    <td class="partial_form_label">
                        <label>姓名</label>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="contact_1_name" name="content1_name" placeholder="請填寫聯絡人姓名" value="<?= $content1_name ?>">
                    </td>
                    <td class="partial_form_label label_with_no_left_padding">
                        <label>關係</label>
                    </td>
                    <td><select id="contact_1_relationship" name="content1_relationship">
                            <?php if ($content1_relationship == "1") { ?>
                                <option value="0">請選擇</option>
                                <option selected value="1">家長</option>
                                <option value="2">監護人</option>
                            <?php } else { ?>
                                <option value="0">請選擇</option>
                                <option value="1">家長</option>
                                <option selected value="2">監護人</option>
                            <?php } ?>

                        </select></td>
                </tr>
                <tr>
                    <td class="partial_form_label">
                        <label>聯絡電話</label>
                    </td>
                    <td colspan="3">
                        <input type="text" class="form-control" id="contact_1_phone" name="content1_phone" placeholder="請填寫聯絡電話" value="<?= $content1_phone ?>">
                    </td>
                </tr>
                <tr>
                    <td class="partial_form_label">
                        <label>電郵</label>
                    </td>
                    <td colspan="3">
                        <input type="text" class="form-control" id="contact_1_email" name="content1_email" placeholder="請填寫電郵" value="<?= $content1_email ?>">
                    </td>
                </tr>
                <tr>
                    <td class="partial_form_label red_label"><label>後備聯絡</label></td>
                    <td style="vertical-align:bottom;" colspan="3">
                        <hr>
                    </td>
                </tr>
                <tr>
                    <td class="partial_form_label">
                        <label>姓名</label>
                    </td>
                    <td>
                        <input type="text" class="form-control" id="contact_2_name" name="content2_name" placeholder="請填寫聯絡人姓名" value="<?= $content2_name ?>">
                    </td>
                    <td class="partial_form_label label_with_no_left_padding">
                        <label>關係</label>
                    </td>
                    <td><select name="content2_relationship">
                            <?php if ($ocntent2_relationship == "1") { ?>
                                <option value="0">請選擇</option>
                                <option selected value="1">家長</option>
                                <option value="2">監護人</option>
                            <?php } else { ?>
                                <option selected value="0">請選擇</option>
                                <option value="1">家長</option>
                                <option selected value="2">監護人</option>
                            <?php } ?>
                        </select></td>
                </tr>
                <tr>
                    <td class="partial_form_label">
                        <label>聯絡電話</label>
                    </td>
                    <td colspan="3">
                        <input type="text" class="form-control" id="contact_2_phone" name="content2_phone" placeholder="請填寫聯絡電話" value="<?= $content2_phone ?>">
                    </td>
                </tr>
                <tr>
                    <td class="partial_form_label">
                        <label>電郵</label>
                    </td>
                    <td colspan="3">
                        <input type="text" class="form-control" id="contact2_email" name="content2_email" placeholder="請填寫電郵" value="<?= $content2_email ?>">
                    </td>
                </tr>
                <tr>
                    <td colspan="3"> <button type="button" class="btn btn-default ">重設</button></td>
                    <td></td>
                </tr>




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

        <script>
            $('.submit').on("click", function() {

                if ($('#student_id').val() == "") {
                    alert('請填寫學生編號');
                    return false;
                }
                if ($('#chi_name').val() == "") {
                    alert('請填寫中文姓名');
                    return false;
                }
                if ($('#eng_name').val() == "") {
                    alert('請填寫英文姓名');
                    return false;
                }
                if ($('#gender').val() == "0") {
                    alert('請選擇性別');
                    return false;
                }
                if ($('#dob').val() == "") {
                    alert("請填寫出生日期");
                    return false;
                }
                if ($('#contact_1_name') == "") {
                    alert("請填寫聯絡人姓名");
                    return false;
                }
                if ($('#contact_1_relationship').val() == "0") {
                    alert("請選擇學生與主聯絡人的關係");
                    return false;
                }
                if ($('#contact_1_phone').val() == "") {
                    alert("請填寫主聯絡人的電話號碼");
                    return false;
                }
                if ($('#contact_1_email').val() == "") {
                    alert("請填寫主絡人的電郵地址");
                    return false;
                }
                if ($('#contact_2_name').val() == "") {
                    alert("請填寫後備聯絡人的姓名");
                    return false;
                }
                if ($('#contact_2_relationship').val() == "0") {
                    alert("請選擇學生與後備聯絡人的關係");
                    return false;
                }
                if ($('#contact_2_phone').val() == "") {
                    alert('請填寫後備聯絡人的電話號碼');
                    return false;
                }
                if ($('#contact_2_email').val() == "") {
                    alert("請填寫後備聯絡人的電郵地址");
                    return false;
                }

            })
        </script>