<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<html>
<head>
    <title>工程量修改页面</title>
    <meta name="decorator" content="ani"/>
    <%@include file="/webpage/include/summernote.jsp" %>
    <style type="text/css">
        input::-webkit-input-placeholder {
            color: red !important;
        }

        input::-moz-placeholder { /* Mozilla Firefox 19+ */
            color: red !important;
        }

        input:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
            color: red !important;
        }

        input:-ms-input-placeholder { /* Internet Explorer 10-11 */
            color: red !important;
        }
    </style>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#beginDate').datetimepicker({
                format: "YYYY-MM-DD HH:mm:ss"
            });
            $('#endDate').datetimepicker({
                format: "YYYY-MM-DD HH:mm:ss"
            });
            $('select').change(function () {
                var includeAutomation = $('#includeAutomation').val();
                var policyIssues = $('#policyIssues').val();
                if (includeAutomation == '是') {
                    $('#wayOf').attr('placeholder', '通信方式不能为空');
                } else {
                    $('#wayOf').removeAttr('placeholder');
                }
                if (policyIssues == '是') {
                    $("#processingDescription").attr('placeholder', '政策处理描述不能为空');
                } else {
                    $("#processingDescription").removeAttr('placeholder');
                }
            });
        });

        function save() {
            var b = check();
            if (!b) {
                jp.error("请正确填写信息");
                return false;
            }
            jp.loading();
            jp.post("${ctx}/managementcenter/activiti/engSave", $("#inputForm").serialize(), function (data) {
                if (data.success) {
                    jp.getParent().refresh();
                    var dialogIndex = parent.layer.getFrameIndex(window.name); //获取窗口索引
                    parent.layer.close(dialogIndex);
                    jp.success(data.msg);
                } else {
                    jp.error(data.msg);
                }
            });
        }

        function check() {
            var flag = true;
            var includeAutomation = $('#includeAutomation').val();
            var wayOf = $('#wayOf').val();
            var policyIssues = $('#policyIssues').val();
            var str = "";
            $("#check :checked").each(function () {
                var val = $(this).val();
                str += val;
            });
            var processingDescription = $('#processingDescription').val();
            if (includeAutomation == '是') {
                if (wayOf == "") {
                    flag = false;
                }
            }
            if (policyIssues == "是") {
                if (str == "" || processingDescription == "") {
                    flag = false;
                }
            }
            return flag;
        }
    </script>
</head>
<body>
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-primary">
                <div class="panel-body">
                    <form:form id="inputForm" modelAttribute="construction" action="" method="post"
                               class="form-horizontal">
                        <form:hidden path="id"/>
                        <input id="procInsId" type="hidden" value="${fns:unescapeHtml(construction.procInsId)}">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <td class="width-15 active"><label class="pull-right"> 是否含自动化：</label></td>
                                <td class="width-35">
                                    <form:input id="includeAutomation" path="quantity.includeAutomation"
                                                cssClass="form-control" readonly="true"/>
                                </td>
                                <td class="width-15 active"><label class="pull-right">通信方式：</label></td>
                                <td class="width-35">
                                    <c:if test="${quantity.includeAutomation == '是'}">
                                    <form:input id="wayOf" path="quantity.wayOf"
                                                cssClass="form-control" placeholder="通信方式不能为空"/>
                                    </c:if>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right"> 作业方式：</label></td>
                                <td class="width-35">
                                    <form:select id="assignmentStyle" path="quantity.assignmentStyle"
                                                 cssClass="form-control">
                                        <form:option value="停电"/>
                                        <form:option value="带点"/>
                                        <form:option value="不涉电"/>
                                    </form:select>
                                </td>
                                <td class="width-15 active"><label class="pull-right">是否含变电站新间隔投运：</label></td>
                                <td class="width-35">
                                    <form:select id="operationSubstation" path="quantity.operationSubstation"
                                                 cssClass="form-control">
                                        <form:option value="否"/>
                                        <form:option value="是"/>
                                    </form:select>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right"> 是否需调整命名编号：</label></td>
                                <td class="width-35">
                                    <form:select id="namingNumber" path="quantity.namingNumber"
                                                 cssClass="form-control">
                                        <form:option value="否"/>
                                        <form:option value="是"/>
                                    </form:select>
                                </td>
                                <td class="width-15 active"><label class="pull-right">是否存在土建验收：</label></td>
                                <td class="width-35">
                                    <form:select id="engineeringAcceptance" path="quantity.engineeringAcceptance"
                                                 cssClass="form-control">
                                        <form:option value="是"/>
                                        <form:option value="否"/>
                                    </form:select>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right"> 是否存在电气验收：</label></td>
                                <td class="width-35">
                                    <form:select id="electricalAcceptance" path="quantity.electricalAcceptance"
                                                 cssClass="form-control">
                                        <form:option value="否"/>
                                        <form:option value="是"/>
                                    </form:select>
                                </td>
                                <td class="width-15 active"><label class="pull-right">停电线路：</label></td>
                                <td class="width-35">
                                    <form:input id="blackoutLine" path="quantity.blackoutLine"
                                                cssClass="form-control" placeholder="不同线路用,分割"/>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">停电范围初步校核</label></td>
                                <td class="width-35">
                                    <form:input id="outageRange" path="quantity.outageRange"
                                                cssClass="form-control"/>
                                </td>
                                <td class="width-15 active"><label class="pull-right"> 是否存在政策处理问题</label></td>
                                <td class="width-35">
                                    <form:select id="policyIssues" path="quantity.policyIssues"
                                                 cssClass="form-control">
                                        <form:option value="否"/>
                                        <form:option value="是"/>
                                    </form:select>
                                </td>
                            </tr>
                            <tr>
                                <td class="width-15 active"><label class="pull-right">政策处理类型：</label></td>
                                <td class="width-35">
                                        <%--                                    <form:input id="processingType" path="quantity.processingType"
                                                                                        cssClass="form-control"/>--%>
                                    <div id="check">
                                        <form:checkboxes id="processingTypeList" path="quantity.processingTypeList"
                                                         items="${courseList}"/>
                                    </div>
                                </td>
                                <td class="width-15 active"><label class="pull-right"> 政策处理描述：</label></td>
                                <td class="width-35">
                                    <form:input id="processingDescription" path="quantity.processingDescription"
                                                cssClass="form-control"/>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form:form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>