<%@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>
<div class="container" style="width: 1200px;">
    <form id="input_form" class="form-horizontal valid" action="${ctx}/user/addDuty"
    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">
                            <c:if test="${not empty param.eid}">
                                <input type="text" style="display: none" name="eid" value="${param.eid}"/>
                            </c:if>
                            <input type="text" style="display: none" name="action" value="${empty param.eid ? 'add' : "edit"}"/>
                            <select name="uid" id="select" <c:if test="${not empty param.eid}">disabled</c:if> >
                                <option value="0">==请选择==</option>

                                <c:forEach items="${userByCity}" var="var" varStatus="vs">
                                    <option value="${var.id}" <c:if test="${var.id eq param.eid}">selected="selected"</c:if>> ${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="${param.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" type="submit">
                                &nbsp;确认
                            </button>
                        </div>
                    </div>
                </div>
            </div>

        </div>

    </form>
</div>

<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>
