<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ 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();
%>
<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 class="active">
                          <strong>合同管理</strong>
                      </li>
                  </ol>
              </div>
          </div>
      </div>
  </div>
  <jsp:include page="../../../common/admin/search_pre.jsp"></jsp:include>
  <input type="hidden" name="formSerialize" />
  <input type="hidden" name="pageNo" value="1" />
  <form id="formSearch" action="<%=basePath%>/admin/contract/list.action" method="get" class="form-inline">
          <div class="form-group">
              <label for="partnerName">合作方名称</label>
              <input type="text" id="partnerName" name="partnerName" class="form-control" />
          </div>

      <div class="form-group">
          <label for="contractState">合同状态</label>
          <select id="contractState" name="contractState" class="form-control">
              <option value="" selected>全部</option>
              <c:forEach items="${dicContractState}" var="item" >
                  <option value="${item.key}">${item.value}</option>
              </c:forEach>
          </select>
      </div>

      <div class="form-group">
          <label for="contractNumber">合同编号</label>
          <input type="text" id="contractNumber" name="contractNumber" class="form-control" />
      </div>



          <div class="form-group">
              <label for="contractDateFrom">发布时间</label>
              <div class="input-group date">
                  <input type="text" id="contractDateFrom" name="contractDateFrom" class="form-control" />
                  <span class="input-group-addon">
                      <span class="glyphicon glyphicon-calendar"></span>
                  </span>
              </div>
              -
              <div class="input-group date">
                  <input type="text" id="contractDateTo" name="contractDateTo" class="form-control" />
                  <span class="input-group-addon">
                      <span class="glyphicon glyphicon-calendar"></span>
                  </span>
              </div>
          </div>

          <div class="form-group">
              <button id="btnSearch" type="button" class="btn btn-sm btn-primary"><i class="fa fa-search"></i>查询</button>
              <button id="btnReset" type="button" class="btn btn-sm btn-default"><i class="fa fa-reply"></i>重置</button>
          </div>

  </form>
  <jsp:include page="../../../common/admin/search_post.jsp"></jsp:include>
  <jsp:include page="../../../common/admin/grid_pre.jsp"></jsp:include>
  <button id="btnAdd" type="button" class="btn btn-sm btn-primary btn-position"><i class="fa fa-plus"></i>新增</button>
  <jsp:include page="../../../common/admin/grid_middle.jsp"></jsp:include>
  <div id="divGrid">
  </div>
  <jsp:include page="../../../common/admin/grid_post.jsp"></jsp:include>
  <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"
      });
      function search() {
          var formSerialize = $("input[type='hidden'][name='formSerialize']").val();
          var pageNo = $("input[type='hidden'][name='pageNo']").val();
          var formData = formSerialize + "&pageNo=" + pageNo;
          console.log(formSerialize);
          $("#divGrid").renderPartial({ url: "<%=basePath%>/admin/contract/list.action", data: formData });
          clearModal();//清除浮层
      }

      $("#btnSearch").click(function () {
          $("input[type='hidden'][name='pageNo']").val(1);
          $("input[type='hidden'][name='formSerialize']").val($("#formSearch").serialize());
          search();
      });

      $("#btnReset").click(function () {
          $('#formSearch').resetForm();
      });

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



      function showunshelveresult(code) {
         if(code==200){
             layer.msg('下架成功', {time: 3000, icon:1});
         }else{
             layer.msg('下架失败', {time: 3000, icon:2});
         }
      }

      function showInfo(id) {
          $.popBsPartial({ url: "<%=basePath%>/admin/contract/info/" + id });
      }
      function  clearModal() {
          $(".modal-backdrop").remove();
      }

      search();
  </script>

</body>
</html>
