<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改职位基础信息')" />
    <th:block th:include="include :: jasny-bootstrap-css" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-postinfo-edit" th:object="${basePostInfo}">
            <input name="objid" th:field="*{objid}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">职位ID：</label>
                <div class="col-sm-8">
                    <input name="postId" th:field="*{postId}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">职位名称：</label>
                <div class="col-sm-8">
                    <input name="postName" th:field="*{postName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">职位类型：</label>
                <div class="col-sm-8">
                    <select name="postTypeId" id="postTypeId" class="form-control m-b">
                        <option name="cbEditPostTypeInfo" th:each="postTypeId:${cbEditPostTypeInfo}" th:value="${postTypeId.postTypeId}" th:text="${postTypeId.postTypeName}" th:selected="${postTypeId.flag}"  th:disabled="${postTypeId.status == '1'}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="col-sm-8">
                    <input name="remark" id="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('sys_status_info')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <script th:inline="javascript">
        var prefix = ctx + "baseinfo/postinfo";
        $("#form-postinfo-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var formData = new FormData();
                formData.append('objid',$("#objid").val());
                formData.append('postId',$("#postId").val());
                formData.append('postName',$("#postName").val());
                formData.append('remark',$("#remark").val());
                formData.append('status', $('input:radio:checked').val());
                formData.append('postTypeId', $.form.selectSelects("postTypeId"));
                $.ajax({
                    url: prefix + "/edit",
                    type: 'post',
                    cache: false,
                    data: formData,
                    processData: false,
                    contentType: false,
                    dataType: "json",
                    success: function(result) {
                        $.operate.successCallback(result);
                    }
                });
            };
        }
    </script>
</body>
</html>