<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改人员信息')" />
    <link th:href="@{/css/use/css1.css}" rel="stylesheet"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <ul class="nav head_top" id="tab">
            <div class="text-right hidden-print" style="float: right">
                <button class="btn btn-unite" onclick="submitHandler()">保存</button>
            </div>
        </ul>
        <form class="form-horizontal m information" id="form-information-edit" th:object="${rwkStaffInformation}">
            <input name="id" th:field="*{id}" type="hidden">
            <table id="informationTable">
                <tr>
                    <td colspan="2">姓名</td>
                    <td colspan="2"><input name="name" class="form-control" type="text" th:field="*{name}"></td>
                    <td colspan="2">性别</td>
                    <td colspan="2"><input name="sex" class="form-control" type="text" th:field="*{sex}"></td>
                    <td colspan="2">民族</td>
                    <td colspan="2"><input name="nation" class="form-control" type="text" th:field="*{nation}"></td>
                    <td colspan="2">国籍</td>
                    <td colspan="2"><input name="nationality" class="form-control" type="text" th:field="*{nationality}"></td>
                    <td colspan="2" rowspan="4" style="min-width: 240px;">
                        <div style="width:100%;display: flex;align-items: center;justify-content: center;flex-direction: column;">
                            <div style="max-width: 131px;max-height: 150px;"><img id="photo" class="img-xs" src="" style="display: none;width: 100%;height: 100%;"/></div>
                            <div style="width: 60%;height: 20%;text-align: center;">
                                <a class="btn btn-unite" onclick="$('#fileUpload').click();">上传照片</a>
                            </div>
                        </div>
                        <input name="photo" class="form-control" type="hidden">
                        <input class="btn btn-unite" type="file" name="fileUpload" id="fileUpload" style="display: none;" onchange="getFileName()" accept=".jpg,.png">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">出生年月日</td>
                    <td colspan="2"><input name="birthday" class="form-control" type="text" th:field="*{birthday}"></td>
                    <td colspan="2">出生地</td>
                    <td colspan="2"><input name="birthplace" class="form-control" type="text" th:field="*{birthplace}"></td>
                    <td colspan="2">籍贯</td>
                    <td colspan="6"><input name="nativePlace" class="form-control" type="text" th:field="*{nativePlace}"></td>
                </tr>
                <tr>
                    <td colspan="2">是否取得境外长期居留资格</td>
                    <td colspan="2"><input name="overseasResidencyStatus" class="form-control" type="text" th:field="*{overseasResidencyStatus}"></td>
                    <td colspan="2">取得国家</td>
                    <td colspan="2"><input name="acquiringCountry" class="form-control" type="text" th:field="*{acquiringCountry}"></td>
                    <td colspan="2">证件号</td>
                    <td colspan="6"><input name="idNumber" class="form-control" type="text" th:field="*{idNumber}"></td>
                </tr>
                <tr>
                    <td colspan="2">参加工作时间</td>
                    <td colspan="4"><input name="workTime" class="form-control" type="text" th:field="*{workTime}"></td>
                    <td colspan="2">身份证号码(★必填)</td>
                    <td colspan="8"><input name="idCard" class="form-control" type="text" th:field="*{idCard}" required></td>
                </tr>
                <tr>
                    <td colspan="2">党派</td>
                    <td colspan="4"><input name="party" class="form-control" type="text" th:field="*{party}"></td>
                    <td colspan="2">党派职务</td>
                    <td colspan="4"><input name="partyPositions" class="form-control" type="text" th:field="*{partyPositions}"></td>
                    <td colspan="2">加入时间</td>
                    <td colspan="4"><input name="joinTime" class="form-control" type="text" th:field="*{joinTime}"></td>
                </tr>
                <tr>
                    <td colspan="2">人才类别</td>
                    <td colspan="6"><input name="talentCategory" class="form-control" type="text" th:field="*{talentCategory}"></td>
                    <td colspan="4">宗教信仰</td>
                    <td colspan="6"><input name="religion" class="form-control" type="text" th:field="*{religion}"></td>
                </tr>
                <tr>
                    <td colspan="4">现任社会职务<span>(包括各级人大、政协等职务)</span></td>
                    <td colspan="8"><input name="currentOccupation" class="form-control" type="text" th:field="*{currentOccupation}"></td>
                    <td colspan="2">知联会职务</td>
                    <td colspan="4"><input name="zlhJob" class="form-control" type="text" th:field="*{zlhJob}"></td>
                </tr>
                <tr>
                    <td colspan="2">全日制教育</td>
                    <td colspan="2">毕业院校及专业</td>
                    <td colspan="4"><input name="qrzSchoolMajor" class="form-control" type="text" th:field="*{qrzSchoolMajor}"></td>
                    <td colspan="2">学历</td>
                    <td colspan="3"><input name="qrzQualification" class="form-control" type="text" th:field="*{qrzQualification}"></td>
                    <td colspan="2">学位</td>
                    <td colspan="3"><input name="qrzDegree" class="form-control" type="text" th:field="*{qrzDegree}"></td>
                </tr>
                <tr>
                    <td colspan="2">在职教育</td>
                    <td colspan="2">毕业院校及专业</td>
                    <td colspan="4"><input name="zzSchoolMajor" class="form-control" type="text" th:field="*{zzSchoolMajor}"></td>
                    <td colspan="2">学历</td>
                    <td colspan="3"><input name="zzQualification" class="form-control" type="text" th:field="*{zzQualification}"></td>
                    <td colspan="2">学位</td>
                    <td colspan="3"><input name="zzDegree" class="form-control" type="text" th:field="*{zzDegree}"></td>
                </tr>
                <tr>
                    <td colspan="2">工作单位及职务</td>
                    <td colspan="6"><input name="unitJob" class="form-control" type="text" th:field="*{unitJob}"></td>
                    <td colspan="2">技术职称</td>
                    <td colspan="3"><input name="technicalTitle" class="form-control" type="text" th:field="*{technicalTitle}"></td>
                    <td colspan="2">专业特长</td>
                    <td colspan="3"><input name="speciality" class="form-control" type="text" th:field="*{speciality}"></td>
                </tr>
                <tr>
                    <td colspan="2">单位属性</td>
                    <td colspan="4"><input name="unitAttribute" class="form-control" type="text" th:field="*{unitAttribute}"></td>
                    <td colspan="2">职务级别</td>
                    <td colspan="4"><input name="jobLevel" class="form-control" type="text" th:field="*{jobLevel}"></td>
                    <td colspan="2">任现职时间</td>
                    <td colspan="4"><input name="currentTenure" class="form-control" type="text" th:field="*{currentTenure}"></td>
                </tr>
                <tr>
                    <td colspan="2">单位地址</td>
                    <td colspan="6"><input name="unitAddress" class="form-control" type="text" th:field="*{unitAddress}"></td>
                    <td colspan="2">电话</td>
                    <td colspan="3"><input name="unitPhone" class="form-control" type="text" th:field="*{unitPhone}"></td>
                    <td colspan="2">邮编</td>
                    <td colspan="3"><input name="unitZipCode" class="form-control" type="text" th:field="*{unitZipCode}"></td>
                </tr>
                <tr>
                    <td colspan="2">家庭地址</td>
                    <td colspan="6"><input name="homeAddress" class="form-control" type="text" th:field="*{homeAddress}"></td>
                    <td colspan="2">电话</td>
                    <td colspan="3"><input name="homePhone" class="form-control" type="text" th:field="*{homePhone}"></td>
                    <td colspan="2">邮编</td>
                    <td colspan="3"><input name="homeZipCode" class="form-control" type="text" th:field="*{homeZipCode}"></td>
                </tr>
                <tr>
                    <td colspan="2">电子信箱</td>
                    <td colspan="5"><input name="email" class="form-control" type="text" th:field="*{email}"></td>
                    <td colspan="2">手机</td>
                    <td colspan="3"><input name="mobilePhone" class="form-control" type="text" th:field="*{mobilePhone}"></td>
                    <td colspan="2">微信号</td>
                    <td colspan="4"><input name="wxCode" class="form-control" type="text" th:field="*{wxCode}"></td>
                </tr>
                <tr>
                    <td colspan="2">业余爱好</td>
                    <td colspan="16"><input name="hobby" class="form-control" type="text" th:field="*{hobby}"></td>
                </tr>
                <tr>
                    <td colspan="2">简历</td>
                    <td colspan="16"><textarea rows="10" name="resume" class="form-control" style="width: 100%;border: none;resize: none;">[[*{resume}]]</textarea></td>
                </tr>
                <tr>
                    <td colspan="2">培训情况</td>
                    <td colspan="16"><textarea rows="10" name="training" class="form-control" style="width: 100%;border: none;resize: none;">[[*{training}]]</textarea></td>
                </tr>
                <tr>
                    <td colspan="2">主要成就<span>(工作成绩、成果、受奖励和荣誉称号等)</span></td>
                    <td colspan="16"><textarea rows="10" name="achievement" class="form-control" style="width: 100%;border: none;resize: none;">[[*{achievement}]]</textarea></td>
                </tr>
                <tr>
                    <td colspan="2" rowspan="6">家庭成员</td>
                    <td colspan="2">称谓</td>
                    <td colspan="3">姓名</td>
                    <td colspan="2">出生年月</td>
                    <td colspan="3">政治面貌</td>
                    <td colspan="6">工作单位及职务</td>
                </tr>
                <tr>
                    <td colspan="2"><input name="rwkFamilyMemberList[0].appellation" class="form-control" type="text" th:field="*{rwkFamilyMemberList[0].appellation}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[0].name" class="form-control" type="text" th:field="*{rwkFamilyMemberList[0].name}"/></td>
                    <td colspan="2"><input name="rwkFamilyMemberList[0].birthday" class="form-control" type="text" th:field="*{rwkFamilyMemberList[0].birthday}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[0].politicalStatus" class="form-control" type="text" th:field="*{rwkFamilyMemberList[0].politicalStatus}"/></td>
                    <td colspan="6"><input name="rwkFamilyMemberList[0].unitJob" class="form-control" type="text" th:field="*{rwkFamilyMemberList[0].unitJob}"/></td>
                </tr>
                <tr>
                    <td colspan="2"><input name="rwkFamilyMemberList[1].appellation" class="form-control" type="text" th:field="*{rwkFamilyMemberList[1].appellation}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[1].name" class="form-control" type="text" th:field="*{rwkFamilyMemberList[1].name}"/></td>
                    <td colspan="2"><input name="rwkFamilyMemberList[1].birthday" class="form-control" type="text" th:field="*{rwkFamilyMemberList[1].birthday}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[1].politicalStatus" class="form-control" type="text" th:field="*{rwkFamilyMemberList[1].politicalStatus}"/></td>
                    <td colspan="6"><input name="rwkFamilyMemberList[1].unitJob" class="form-control" type="text" th:field="*{rwkFamilyMemberList[1].unitJob}"/></td>
                </tr>
                <tr>
                    <td colspan="2"><input name="rwkFamilyMemberList[2].appellation" class="form-control" type="text" th:field="*{rwkFamilyMemberList[2].appellation}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[2].name" class="form-control" type="text" th:field="*{rwkFamilyMemberList[2].name}"/></td>
                    <td colspan="2"><input name="rwkFamilyMemberList[2].birthday" class="form-control" type="text" th:field="*{rwkFamilyMemberList[2].birthday}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[2].politicalStatus" class="form-control" type="text" th:field="*{rwkFamilyMemberList[2].politicalStatus}"/></td>
                    <td colspan="6"><input name="rwkFamilyMemberList[2].unitJob" class="form-control" type="text" th:field="*{rwkFamilyMemberList[2].unitJob}"/></td>
                </tr>
                <tr>
                    <td colspan="2"><input name="rwkFamilyMemberList[3].appellation" class="form-control" type="text" th:field="*{rwkFamilyMemberList[3].appellation}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[3].name" class="form-control" type="text" th:field="*{rwkFamilyMemberList[3].name}"/></td>
                    <td colspan="2"><input name="rwkFamilyMemberList[3].birthday" class="form-control" type="text" th:field="*{rwkFamilyMemberList[3].birthday}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[3].politicalStatus" class="form-control" type="text" th:field="*{rwkFamilyMemberList[3].politicalStatus}"/></td>
                    <td colspan="6"><input name="rwkFamilyMemberList[3].unitJob" class="form-control" type="text" th:field="*{rwkFamilyMemberList[3].unitJob}"/></td>
                </tr>
                <tr>
                    <td colspan="2"><input name="rwkFamilyMemberList[4].appellation" class="form-control" type="text" th:field="*{rwkFamilyMemberList[4].appellation}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[4].name" class="form-control" type="text" th:field="*{rwkFamilyMemberList[4].name}"/></td>
                    <td colspan="2"><input name="rwkFamilyMemberList[4].birthday" class="form-control" type="text" th:field="*{rwkFamilyMemberList[4].birthday}"/></td>
                    <td colspan="3"><input name="rwkFamilyMemberList[4].politicalStatus" class="form-control" type="text" th:field="*{rwkFamilyMemberList[4].politicalStatus}"/></td>
                    <td colspan="6"><input name="rwkFamilyMemberList[4].unitJob" class="form-control" type="text" th:field="*{rwkFamilyMemberList[4].unitJob}"/></td>
                </tr>
            </table>
            <input name="familyMemberCode" th:field="*{familyMemberCode}" type="hidden">
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/information";
        $("#form-information-edit").validate({
            focusCleanup: true
        });
        var photo = [[${rwkStaffInformation.photo}]];
        init();

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.saveTab(prefix + "/edit", $('#form-information-edit').serialize());
            }
        }

        function init(){
            if (photo){
                $("input[name=photo]").val(photo);
                $("#photo").attr("src",photo).show();
            }
        }

        //上传图片
        function getFileName() {
            var file = $("#fileUpload")[0].files[0];
            var filename = file.name;
            var formData = new FormData();
            formData.append("file", file);
            var allowedExtensions = /(\.jpg|\.png)$/i;
            var fileExtension = filename.substring(filename.lastIndexOf('.')).toLowerCase();
            //判断文件是否符合规范
            if (allowedExtensions.test(fileExtension)) {
                $.ajax({
                    url: ctx + 'common/upload',
                    type: 'POST',
                    data: formData,
                    contentType: false,
                    processData: false,
                    success: function (response) {
                        $("input[name=photo]").val(response.url);
                        $("#photo").attr("src", response.url).show();
                    },
                    error: function (xhr, status, error) {
                        console.error(error);
                    }
                });
            } else {
                $.modal.alertError("该文件类型不符合");
            }
        }
    </script>
</body>
</html>