
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String basePath = request.getContextPath();
%>
<!DOCTYPE html>
<html>
<head>
    <jsp:include page="../../../common/admin/head.jsp"></jsp:include>
</head>
<body>
<jsp:include page="../../../common/admin/body_pre.jsp"></jsp:include>
<div class="row hidden-print">
    <div class="col-lg-12">
        <div class="ibox">
            <div class="ibox-title">
                <h2>新增合同</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="javascript:void(0);">流通管理</a>
                    </li>
                    <li>
                        <a href="<%=basePath%>/admin/contract/index.htm">合同管理</a>
                    </li>
                    <li class="active">
                        <strong>新增合同</strong>
                    </li>
                </ol>
            </div>
        </div>
    </div>

    <div class="col-md-12 column">
        <form class="form-horizontal" id="contractResource" method="post" class="form-horizontal" enctype="multipart/form-data"
              action="<%=basePath%>/admin/contract/addFinally.action">
            <input type="hidden" name="api_badge" id="api_badge" value=0>
            <div class="form-group">
                <label for="contractNumber" class="col-sm-2 control-label">合同编号</label>
                <div class="col-sm-8">
                    <input type="text" id="contractNumber" name="contractNumber" value="${contractNumber}" class="form-control" readonly/>
                </div>
            </div>
            <div class="form-group">
                <label for="contractName" class="col-sm-2 control-label">合同名称</label>
                <div class="col-sm-8">
                    <input type="text" id="contractName" name="contractName" class="form-control"/>
                    <span class="field-validation-valid help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label for="partnerName" class="col-sm-2 control-label">合作方名称</label>
                <div class="col-sm-8">
                    <input type="text" id="partnerName" name="partnerName" class="form-control"/>
                    <span class="field-validation-valid help-block"></span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">生效时间</label>
                <div class="col-md-8 col-sm-7">
                    <div class="input-group date">
                        <input type="text" id="effectiveTime" name="effectiveTime" class="form-control"/>
                        <span class="input-group-addon">
                        <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">到期时间</label>
                <div class="col-md-8 col-sm-7">
                    <div class="input-group date">
                        <input type="text" id="expiredTime" name="expiredTime" class="form-control"/>
                        <span class="input-group-addon">
                      <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label for="contractAmount" class="col-sm-2 control-label">合同总金额</label>
                <div class="col-sm-8">
                    <input type="text" id="contractAmount" name="contractAmount" class="form-control" value=0 />
                </div>
            </div>
            <div class="form-group">
                <label for="contact" class="col-sm-2 control-label">联系人</label>
                <div class="col-sm-8">
                    <input type="text" id="contact" name="contact" class="form-control"/>
                    <span class="field-validation-valid help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label for="contactInfo" class="col-sm-2 control-label">联系信息</label>
                <div class="col-sm-8">
                    <input type="text" id="contactInfo" name="contactInfo" class="form-control"/>
                    <span class="field-validation-valid help-block"></span>
                </div>
            </div>
            <div class="form-group">
                <label  class="col-sm-2 control-label"></label>
                <table id="contactResource" class="table table-hover  table-condensed table-bordered "
                       style="width: 66%;margin-left:10%" align="center">
                    <thead>
                    <tr>
                        <th>合同资源信息</th>
                        <th>计费规则</th>
                        <th>费用</th>
                        <th>月数限制</th>
                        <th>次数限制</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                </table>
                <button id="btnAdd" type="button" class="btn btn-sm btn-primary btn-position" style="margin-right:20%">
                    <i class="fa fa-plus"></i>增加资源
                </button>
            </div>

            <div class="form-group">
                <label for="attachmentFile" class="col-lg-2  text-right">电子版合同</label>
                <div class="col-md-7 col-sm-7">
                    <input  id="attachmentFile" type="file" name="attachmentFile" accept="application/pdf,application/msword"/>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-7 text-center">
                    <button type="button" id="submitButton" class="btn btn-primary"><i class="fa fa-check"></i>提交</button>
                    <button type="button" id="cancel" class="btn btn-default" data-dismiss="modal"><i
                            class="fa fa-close"></i>返回
                    </button>
                </div>
            </div>
            <input type="hidden" id="resourceBadge" value=0>
        </form>
    </div>
</div>
<jsp:include page="../../../common/admin/body_post.jsp"></jsp:include>
<script type="text/javascript">

    $(".input-group.date").datetimepicker({
        format: "YYYY-MM-DD",
        locale: "zh-cn"
    });


    $("#btnAdd").click(function () {
        $.popBsPartial({url: "<%=basePath%>/admin/contract/addResource.htm",size: WySharpSize.Large});
    });

    $("#cancel").click(function () {
        window.location.href = "<%=basePath%>/admin/contract/index.htm";
    });

    $("#submitButton").click(function () {
        $('#contractResource').ajaxValSubmit({
            ajaxSubmitOptions: {
                onSuccess: function () {
                    window.location.href = "<%=basePath%>/admin/contract/index.htm";
                }
            }
        });
    });
</script>
</body>
</html>