<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="关联任务表单" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
        <input name="id" value="${bpmTaskFrom.id}" type="hidden">
        <input name="processDefinitionKey" value="${bpmProcess.id}" type="hidden">
        <input name="version" value="v${bpmProcess.version?string}" type="hidden">
        <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "流程名称"/>：</label>
                    <div class="col-sm-8">
                        <input class="form-control"  value="${bpmProcess.name}" type="text"  readonly="true">
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "流程类型"/>：</label>
                    <div class="col-sm-8">
                        <input class="form-control" value="${dict.getLabel('sys_bpm_category', bpmProcess.category)}" type="text" readonly="true">
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "业务名称"/>：</label>
                    <div class="col-sm-8">
                        <input name="fromName" class="form-control" value="${bpmTaskFrom.fromName}" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "流程定义Key"/>：</label>
                    <div class="col-sm-8">
                        <input class="form-control" name="modelKey" value="${bpmProcess.modelKey}" type="text" readonly="true">
                    </div>
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-2 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "申请表单URL"/>：</label>
                    <div class="col-sm-10">
                        <input class="form-control" name="prefixUrl"  value="${bpmTaskFrom.prefixUrl?default("")}" type="text" required>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "申请表单形式"/>：</label>
                    <div class="col-sm-8">
                        <select name="applyType" class="form-control">
                            <#list dict.getType('sys_bpm_from_type')>
                                <#items as d>
                                    <#if d.status =='0' >
                                        <option value="${d.dictValue}" <#if (d.isDefault =='Y' && bpmTaskFrom.applyType == "") ||
                                        (bpmTaskFrom.applyType ==d.dictValue ) >selected="selected"</#if>><@ctx.i18n text = "${d.dictLabel}"/></option>
                                    </#if>
                                </#items>
                            </#list>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "审批表单形式"/>：</label>
                    <div class="col-sm-8">
                        <select name="approvalType" class="form-control">
                            <#list dict.getType('sys_bpm_from_type')>
                                <#items as d>
                                    <#if d.status =='0' >
                                        <option value="${d.dictValue}" <#if (d.isDefault =='Y' && bpmTaskFrom.approvalType == "") ||
                                        (bpmTaskFrom.approvalType ==d.dictValue ) >selected="selected"</#if>><@ctx.i18n text = "${d.dictLabel}"/></option>
                                    </#if>
                                </#items>
                            </#list>
                        </select>
                    </div>
                </div>
            </div>
        </div>
    </@f.form>
    <div class="hr-line-dashed"></div>
    <div class="row" style="text-align: center;" id="_addTab">
        <button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
        <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
    </div>
 </div>
<@footer>
<script type="text/javascript">
    var prefix = baseURL + "bpm/procdef";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function submitHandler() {
        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/taskfrom/edit", $('#task-form-complete').serialize());
        }
    }
</script>
</@footer>
</@pageTheme>