<%@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/pblist"
      method="get"--%>>

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


            <input type="hidden" id="entity_onduty"
                   name="entity.onduty" class="required" maxlength="24"
                   value="${entity.onduty}"/>

            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">ID:</label>
                    <div class="controls">
                        <input type="text" id="entity_userId" disabled="disabled"
                               name="entity.userId" class="required" maxlength="24"
                               value="${entity.userId}"/>


                    </div>
                </div>
            </div>


            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">姓名:</label>
                    <div class="controls">
                        <input type="text" id="entity_name" disabled="disabled"
                               name="entity.name" class="required" maxlength="24"
                               value="${entity.name}"/>


                    </div>
                </div>
            </div>
            <div class="row-fluid">
                <div class="span6 control-group">
                    <label class="control-label">排序值:</label>
                    <div class="controls">
                        <input type="text" id="entity_order"
                               name="entity.order" class="required" maxlength="3"
                               value="${entity.order}"/>


                    </div>
                </div>
            </div>
            <div class="row-fluid">
            <div class="portlet-header">
                <div class="operation-btn col-md-offset-4 col-lg-offset-4col-xl-offset-4">

                 <%--   <a href="${ctx}/user/pbelist/${userId}" class="btn gray"><i
                            class="icon-mail-reply"></i>&nbsp;恢复原来值</a>--%>

                    <button class="btn blue btn col-lg-pull-12" onclick="save(${entity.userId},${entity.onduty})">
                        &nbsp;确认
                    </button>
                    <a href="${ctx}/user/pblist" class="btn gray"><i
                            class="icon-mail-reply"></i>&nbsp;返回</a>

                </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 save(userId,onduty) {
        var order = document.getElementById("entity_order").value;
        var orderInt = parseInt(order);
        if(onduty==1){
            alert("当天值日不可修改!!!")
            return;
        }
        if(order>100){
            alert("排序值不能大于100!!!")
            return;
        }
        if (order == "") {
            alert("排序值不能为null!!!")
            return;
        }
        $.ajax({
            url: '${ctx}/user/updateDuty/' + userId + '/' + 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>
