<%@ page import="com.alibaba.fastjson.JSON" %>
<%@ page import="com.jeeplus.modules.workcontent.entity.WorkContentContprogram" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>

<form:form id="subForm" modelAttribute="workContentContprogram" action="#" method="post" class="form-horizontal">
    <form:hidden path="id"/>
    <div class="form-group layui-row lw12">
        <div class="layui-item layui-col-sm6">
            <label class="layui-form-label"><span class="require-item">*</span>合同分类：</label>
            <div class="layui-input-block">
                <select id="contCate" name="contCate" class="form-control layui-input required">
                    <option value="" label=""/>
                    <c:forEach items="${fns:getDictList('content_contract_type')}" var="item">
                        <optgroup value="${item.value}" label="${item.label}"/>
                        <c:set var="typename" value="content_contract_type_${item.value}"></c:set>
                        <c:forEach items="${fns:getDictList(typename)}" var="item2">
                            <option value="${item2.value}" <c:if test="${workContentContprogram.contCate eq item2.value}">selected</c:if>>${item2.label}</option>
                        </c:forEach>
                    </c:forEach>
                </select>
            </div>
        </div>
        <%--<div class="layui-item layui-col-sm6">--%>
            <%--<label class="layui-form-label"><span class="require-item">*</span>合同属性：</label>--%>
            <%--<div class="layui-input-block">--%>
                <%--<form:select path="contAttr" class="form-control layui-input required">--%>
                    <%--<option value="" label=""/>--%>
                    <%--<form:options items="${fns:getMainDictList('content_contract_attr')}" itemLabel="label" itemValue="value" htmlEscape="false"/>--%>
                <%--</form:select>--%>
            <%--</div>--%>
        <%--</div>--%>
        <div class="layui-item layui-col-sm6">
            <label class="layui-form-label"><span class="require-item">*</span>合同价格类型：</label>
            <div class="layui-input-block">
                <form:select path="priceType" class="form-control layui-input required">
                    <form:option value="" label=""/>
                    <form:options items="${fns:getMainDictList('content_contract_price_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                </form:select>
            </div>
        </div>
        <div class="layui-item layui-col-sm6">
            <label class="layui-form-label"><span class="require-item">*</span>招标方式：</label>
            <div class="layui-input-block">
                <form:select path="bidType" class="form-control layui-input required">
                    <form:option value="" label=""/>
                    <form:options items="${fns:getDictList('content_bidding_type')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
                </form:select>
            </div>
        </div>
    </div>

    <div class="form-group layui-row lw12">
        <div class="form-group-label"><h2>规划详情</h2></div>
        <div class="layui-item layui-col-sm6">
            <label class="layui-form-label">与其他合约关系：</label>
            <div class="layui-input-block with-icon">
                <sys:gridselectProjcontent url="${ctx}/projectcontentinfo/projectContentData/selectcontent" id="otherProgramId" name="otherProgram.id"  value="${workContentContprogram.otherProgram.id}"  title="选择合约" labelName="otherProgram.name"
                                           extId="${workContentContprogram.contentId}"    labelValue="${workContentContprogram.otherProgram.name}" cssClass="form-control layui-input " projectId="${workContentContprogram.projectId}" type="31" fieldLabels="" fieldKeys="" searchLabel="${fns:urlEncode('合约名称')}" searchKey="" ></sys:gridselectProjcontent>
            </div>
        </div>
        <div class="layui-item layui-col-sm12 with-textarea">
            <label class="layui-form-label">合同范围：</label>
            <div class="layui-input-block">
                <form:textarea path="scope" htmlEscape="false" rows="3"  class="form-control  "/>
            </div>
        </div>
        <div class="layui-item layui-col-sm12 with-textarea">
            <label class="layui-form-label">处理：</label>
            <div class="layui-input-block">
                <form:textarea path="inteface" htmlEscape="false" rows="3"    class="form-control  "/>
            </div>
        </div>
    </div>
</form:form>
    <script type="text/javascript">
        var validateForm;
        validateForm = $("#subForm").validate({
            submitHandler: function(form){
                loading('正在提交，请稍等...');
                form.submit();
            },
            errorContainer: "#messageBox",
            errorPlacement: function(error, element) {
                $("#messageBox").text("输入有误，请先更正。");
                if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
                    error.appendTo(element.parent().parent());
                } else {
                    error.insertAfter(element);
                }
            }
        });
        function genDetailStr(){
            return JSON.stringify($("#subForm").serializeJson());
        }
    </script>