
<script type="text/template" id="template_add_tpl">
    <div class="tmpl-create">
        <form action="javascript:;" method="post" id="tmpl_create">
            <div class='tmpl-minheight'>
                <div class="fill">
                    <div class="row mb">
                        <div class="span6">
                            <p class="mbm">
                                <span>模板名称</span>
                                <span class="xcr">*</span>
                            </p>
                            <input type="text" name="template[tname]" maxlength="8" value="<%= tname %>" placeholder="请输入模板名称(不得超过8个字)">
                            <input type="hidden" name="template[tid]" value="<%= tid %>" >
                        </div>
                        <div class="span6">
                            <p class="mbm">
                                <span>模板图标</span>
                            </p>
                            <div>
                                <i class="o-rp-template icon-middle <%= pictureurl %>" data-action="tplIcon"></i>
                                <input type="hidden" name="template[pictureurl]" value="<%= pictureurl %>">
                                <span class="lhf tcm">不选则自动使用默认图标</span>
                            </div>
                        </div>
                    </div>
                    <div class="row mb">
                        <div class="span6">
                            <p class="mbm">
                                <span>自动汇报标题</span>
                            </p>
                            <input type="text" name="template[autonumber]" placeholder="请输入表达式(选填)" value="<%= autonumber %>">
                            <p id="tname_preview" class="tcm text-break">汇报标题预览：<span>2016年12月12日王大锤上方报表</span></p>
                        </div>
                        <div class="span6">
                            <p class="mb pbm"></p>
                            <a href="javascript:;" class="xcbu lhf" data-toggle="tooltip" data-placement="bottom" data-html="true"
                                data-original-title="<p class='xcm mb'>表达式中可以使用以下特殊标记：</p>
                                                    <div class='mb'>
                                                        {M}：代表月<br>
                                                        {D}：代表日<br>
                                                        {H}：代表主部门<br>
                                                        {U}：代表用户姓名<br>
                                                        {T}：代表模板名称<br>
                                                        {字段名}：该字段填写的内容会显示在标题上(仅限短文本)
                                                    </div>
                                                    <div class='mb'>
                                                        <span class='xcm'>例</span>，表达式：{Y}-{U}-{主题名称}-{T}<br>
                                                        <span class='xcm'>则</span>，显示为：2016-王大锤-桐城-业务报表
                                                    </div>
                                                    <p>如果不填写表达式，则默认将模板名称显示为汇报标题</p>">说明示例
                            </a>
                        </div>
                    </div>
                </div>
                <div class="sys-nav-area">
                    <div class="sys-nav-top clearfix">
                        <div class="nav-w70 xac">
                            排序
                        </div>
                        <div class="nav-w240">
                            字段名称
                        </div>
                        <div class="nav-w240">
                            字段类型
                        </div>
                        <div class="nav-w76">
                            是否必填
                        </div>
                        <div class="nav-w154"></div>
                    </div>
                    <div class="sys-nav-content">
                        <ul class="nav-main-list ui-sortable" id="nav_main_list"></ul>
                    </div>
                    <div class="nav-main-add">
                        <a href="javascript:void(0);" data-target="#nav_main_list" class="operate-group"
                        data-act="add_main">
                            <i class="cbtn o-plus">
                            </i>
                            添加选项
                        </a>
                    </div>
                </div>
            </div>
            <div class="fill">
                <a class="btn btn-large btn-submit" href="javascript:history.back();">返回</a>
                <button type="button" data-action="sure" class="btn btn-large btn-submit btn-primary pull-right"><% if(tid){ %>完成<% }else{ %>确定<% } %></button>
            </div>
        </form>
    </div>
</script>
<script type="text/ibos-template" id="new_main_nav">
    <li data-id="<%= id %>">
        <div class="nav-item main-nav-item clearfix">
            <div class="nav-w70 li-bg">
                <div class="drap-area">
                    <i class="drap-icon"></i>
                </div>
                <input type="hidden" name="fields[<%= id %>][fieldsort]" value="<%= id %>">
            </div>
            <div class="nav-w240">
                <div class="span10">
                    <input type="text" value="<%= fieldname %>" name="fields[<%= id %>][fieldname]" placeholder="请输入内容">
                </div>
            </div>
            <div class="nav-w240 system-url">
                <div class="span10">
                    <select name="fields[<%= id %>][fieldtype]" data-id="<%= id %>">
                        <option <% if(fieldtype == 1){ %>selected<% } %> value="1">长文本</option>
                        <option <% if(fieldtype == 2){ %>selected<% } %> value="2">短文本</option>
                        <option <% if(fieldtype == 3){ %>selected<% } %> value="3">数字</option>
                        <option <% if(fieldtype == 4){ %>selected<% } %> value="4">日期与时间</option>
                        <option <% if(fieldtype == 5){ %>selected<% } %> value="5">时间</option>
                        <option <% if(fieldtype == 6){ %>selected<% } %> value="6">日期</option>
                        <option <% if(fieldtype == 7){ %>selected<% } %> value="7">下拉</option>
                        <option <% if(fieldtype == 8){ %>selected<% } %> value="8">富文本</option>
                    </select>
                </div>
            </div>
            <div class="nav-w76 isuse">
                <input type="checkbox" <% if( iswrite == "1" ){ %>checked value="1"<%}else{%>value="0"<%}%> name="fields[<%= id %>][iswrite]" data-toggle="switch">
            </div>
            <div class="nav-w150">
                <div class="pull-right mr">
                    <a href="javascript:;" title="删除" data-id="<%= id %>" class="cbtn o-trash"></a>
                </div>
            </div>
            <input type="hidden" name="fields[<%= id %>][fieldvalue]" value="">
        </div>
        <% if( fieldtype == 7 ){ %>
        <div class="add-nav-item">
            <ul class="nav-child-list" data-id="<%= id %>" id="sys_child_<%= id %>_body">
                <% fieldvalue = fieldvalue || [''];
                    for(var i=0, len = fieldvalue.length; i<len; i++){ 
                        var child_id = new Date().getTime() + i; 
                %>
                <li data-child-id="<%= child_id %>" <% if(i == len - 1){ %>class="msts-last"<%}%>>
                    <div class="mst-board nav-item child-nav-item clearfix">
                        <div class="nav-w70"></div>
                        <div class="child-item-input">
                            <div class="span1">
                                <div class="w70"></div>
                            </div>
                            <div class="span8">
                                <input type="text" class="nav-w240" placeholder="请输入内容" value="<%= fieldvalue[i] %>" name="fields[<%= id %>][fieldvalue][<%= child_id %>]">
                            </div>
                            <div class="span1">
                                <i data-child-id="<%= child_id %>" class="o-close"></i>
                            </div>
                        </div>
                    </div>
                </li>
                <% } %>
                <li data-act="childItem">
                    <div class="nav-item child-nav-item clearfix">
                        <div class="nav-w70"></div>
                        <div class="child-item-input">
                            <div class="span1"></div>
                            <div class="span8">
                                <a href="javascript:void(0);" data-id="<%= id %>" class="operate-group">
                                    <i class="cbtn o-plus">
                                    </i>
                                    添加下拉选项
                                </a>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </div>
        <% } %>
    </li>
</script>
<script type="text/template" id="new_nav">
    <li data-child-id="<%= index %>" class="msts-last">
        <div class="mst-board nav-item child-nav-item clearfix">
            <div class="nav-w70"></div>
            <div class="child-item-input">
                <div class="span1">
                    <div class="w70"></div>
                </div>
                <div class="span8">
                    <input type="text" class="nav-w240" placeholder="请输入内容" name="fields[<%= id %>][fieldvalue][<%= index %>]">
                </div>
                <div class="span1">
                    <i data-child-id="<%= index %>" class="o-close"></i>
                </div>
            </div>
        </div>
    </li>
</script>
<script type="text/template" id="tpl_icons_tpl">
    <div class="tpl_icons">
        <ul class="clearfix">
            <% for(var i=0, len=data.length; i<len; i++){ %>
            <li data-name="<%= data[i] %>">
                <i class="icon <%= data[i] %>"></i>
            </li> 
            <% } %>
        </ul>
    </div>
</script>