<!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 :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-postinfo-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">职位ID：</label>
                <div class="col-sm-8">
                    <input name="postId" id="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" id="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 ">
                        <option value="">--请选择职位类型--</option>
                        <option name="cbPostTypeInfo" th:each="posttypeid:${cbPostTypeInfo}" th:value="${posttypeid.postTypeId}" th:text="${posttypeid.postTypeName}" 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" class="form-control" type="text">
                </div>
            </div>


        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: jasny-bootstrap-js" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "baseinfo/postinfo"
        $("#form-postinfo-add").validate({
            focusCleanup: true
        });

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