<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>排班新增</title>
</head>
<style type="text/css">
    .img-show {
        width: 160px;
        height: 120px;
        border: 1px solid #ccc;
        padding: 2px;
        border-radius: 5px;
        -webkit-border-radius: 5px;
        -moz-border-radius: 5px;
        -ms-border-radius: 5px;
        -o-border-radius: 5px;
    }
</style>
<body>
<%@include file="/WEB-INF/common/layouts/topbar.jsp" %>
<form id="input_form" class="form-horizontal valid"
      <%--action="${ctx}/user/pblist"
      method="get"--%>>

    <!-- 面包屑 end -->
    <house365:flushMessage/>
    <div class="row${fluid}">
        <div class="span12">


            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">选择员工<span style="color: red;">*</span>:</label>
                    <div class="controls">

                        <select name="name" id="select" style="width: 95%">
                            <option value="0">==请选择==</option>

                            <c:forEach items="${userByCity}" var="var" varStatus="vs">
                                <option value="${var.id}_${var.realName}"> ${var.realName} ${var.position}</option>

                            </c:forEach>
                        </select>

                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">排序值<span style="color: #ff0000;">*</span>:</label>
                    <div class="controls">
                        <input type="text" id="order"
                               name="order" class="required" maxlength="64"
                               value="${order}"/>
                    </div>
                </div>
            </div>
            <div class="portlet-header">
                <div class="row-fluid">
                    <div class="operation-btn span18">

                        <a href="${ctx}/user/pblist" class="btn gray"><i
                                class="icon-mail-reply"></i>&nbsp;返回</a>

                        <button class="btn blue btn col-lg-pull-12" onclick="save1()">
                            &nbsp;确认
                        </button>
                    </div>
                </div>
            </div>
        </div>

    </div>

</form>
<script language="javascript" type="text/javascript" src="${ctx}/resources/customize/js/layer.js"></script>
<script type="text/javascript">
   function save1() {
        var order = document.getElementById("order").value;
        var myselect = document.getElementById("select");
       var index=myselect.selectedIndex;
       var id_name =myselect.options[index].value
        if (order == "") {
            alert("排序值不能为null!!!")
        }
        $.ajax({
            url: '${ctx}/user/addDuty/' + id_name + '/' + order,
            type: 'GET',
            contentType: 'application/json',
            data: '',
            dataType: 'json',
            cache: false,
            async:false,
            success: function () {
                alert("增加成功！！！")
                location.href = '${ctx}/user/pblist'
            },
            error:function(){
                alert("增加成功！！！")
                location.href = '${ctx}/user/pblist'
            }
        });
    }

</script>
</body>
</html>
