<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改问题反馈')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: summernote-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-feedback-edit" th:object="${feedback}">
            <input name="feedbackId" th:field="*{feedbackId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">系统名称：</label>
                <div class="col-sm-8">
                    <select name="danganId" class="form-control" required  th:field="*{danganId}" >
                        <option value="">请选择</option>
                        <option th:each="dangan:${danganList}" th:text="${dangan.danganName}" th:value="${dangan.danganId}" ></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">主题：</label>
                <div class="col-sm-8">
                    <textarea name="feedbackTheme" th:field="*{feedbackTheme}" class="form-control" type="text"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">反馈内容：</label>
                <div class="col-sm-8">
                    <textarea type="text" class="form-control" th:field="*{content}" rows="4"></textarea>
                </div>
            </div>
            <div class="form-group">
                <input type="hidden" id="fileName" name="fileName">
                <input type="hidden" id="filePath" name="filePath">
                <label  class="col-sm-3 control-label "  >附件：</label>
                <div class="col-sm-8">
                    <div class="input-group m-b" th:if="${fileList.size()>0}" th:each="fileInfo,state : ${fileList}" th:id="${state.index}">
                        <!--<span class="input-group-addon" th:onclick="download([[${fileInfo.filePath}]],[[${fileInfo.fileName}]]);"><i class="fa fa-download"></i></span>-->
                        <span class="input-group-addon" th:onclick="preview([[@{${fileInfo.filePath}}]])"><i class="fa fa-file"></i></span>
                        <span type="text" class="form-control" th:text="${fileInfo.fileName}" ></span>
                    </div>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: summernote-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/feedback";
        $("#form-feedback-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-feedback-edit').serialize());
            }
        }

        $("input[name='feedbackTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        function preview(filePath){
            console.log("filePath="+filePath);
            window.open(filePath);
        }
    </script>
</body>
</html>