<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html; charset=UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String basePath = request.getContextPath();
    String resourcePath = basePath + "/resource";
%>
<!DOCTYPE html>
<html>
<head>
    <title>需求发布</title>
    <jsp:include page="../common/head.jsp"></jsp:include>
</head>
<jsp:include page="../common/body_header.jsp"></jsp:include>
<body>

<div class="line0"></div>
<div class="mid-fabu1">
    <div class="form-fabu1">
        <div class="fabufont">发布您的需求</div>
        <div class="line-fabu"></div>
        <div class="clearfix"></div>
        <div class="fabu001">
            <form id="publshForm"  method="post">
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>需求名称</span>
                    <span class="ff1">
                    <input type="text" class="fabuinput" name="rqrmntName" placeholder="请输入需求名称">
                    <div class="tishi4"></div>
                    </span>
                </div>
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>需求摘要</span>
                    <span class="ff1">
                    <textarea  id="" cols="30" rows="2" name="rqrmntSummary" class="fabuinput1" placeholder="请输入需求摘要" ></textarea>
                    <div class="tishi4"></div>
                    </span>
                    </span>
                </div>
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>任务金额</span>
                    <span class="ff1">
                    <input type="text" class="fabuinput"name="money" placeholder="">
                    <div class="tishi4"></div>
                    </span>
                </div>
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>截止时间</span>
                    <span class="ff1">
                    <input type="text" id="datetimepicker" class="fabuinput" name="deadline" placeholder="请选择截止时间">
                    <div class="tishi4"></div>
                    </span>
                </div>
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>联系人</span>
                    <span class="ff1">
                    <input type="text" class="fabuinput"name="contact" placeholder="张亮亮">
                    <div class="tishi4"></div>
                    </span>
                </div>
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>联系电话</span>
                    <span class="ff1">
                    <input type="text" class="fabuinput" name="phone" placeholder="13728283838">
                    <div class="tishi4"></div>
                    </span>
                </div>
                <div class="fabu-01">
                    <span class="fabufont1"><span class="xinghao">*</span>分类</span>
                    <%--<input type="text" class="fabuinput" name="categoryId" placeholder="请选择类型">--%>
                    <span class="ff1">
                    <select class="fabuinput5" name="categoryId" >
                        <option></option>
                        <c:forEach var="item" items="${obj}">
                            <option value="${item.id}">${item.catelogName}</option>
                        </c:forEach>
                    </select>
                        <div class="tishi4"></div>
                    </span>

                </div>
                <div class="fabu-01">
                    <span class="fabufont1">需求用户</span>
                    <input type="text" class="fabuinput111" value="${sessionScope.userinfo}"readonly >
                </div>
                <div class="fabu-01">
                    <span class="fabufont1">邮箱</span>
                    <span class="ff1">
                    <input type="text" class="fabuinput" name="email" placeholder="请输入邮箱地址">
                    </span>
                </div>

                <div class="clearfix"></div>
                <button class="fabu-but" type="button" onclick="toPublish()">发布</button>
            </form>
        </div>
    </div>

</div>
<jsp:include page="../common/body_footer.jsp"></jsp:include>
</body>
<script>
    function toPublish() {
        $('.tishi4').text('');//清空验证
       $.ajax({

           url:"<%=basePath%>/open/requirementMicroapp/publish.action",
           type:"post",
           data:$("#publshForm").serialize(),
            success:function (msg) {
                if(msg.stateCode==200) {
                    alert(msg.msg);
                    window.location.href="<%=basePath%>/open/requirementMicroapp/openList.action";
                }else{
                    for(var item in msg.data){
                        $("[name='"+item+"']").next().text("! "+msg.data[item]);
                        $("[name='"+item+"']").next().show();
                    }
                }
            }
    })
    }

    $.datetimepicker.setLocale('zh');
    $("#datetimepicker").datetimepicker({
        format: 'Y-m-d'
    });

</script>
</html>