<#include "../include_page/extendsFieldType.html"/>
<#include "../include_page/sortable.html"/>
<#macro extends name extendList=[] searchable=false sortable=false copy=false>
<table class="list nowrap sortDrag itemDetail" addButton="<@t.page 'button.new_line'/>" width="100%">
    <thead>
        <tr>
            <th type="text" name="${name}[#index#].id.code" size="10" fieldClass="required letterstart"><@t.page 'code'/></th>
            <th type="enum" name="${name}[#index#].inputType" enumUrl="common/extendsFieldType.html?searchable=${searchable?c}" fieldClass="required" size="10" width="100"><@t.page 'field_type'/></th>
            <th type="text" name="${name}[#index#].name" size="10" fieldAttrs='{"maxlength":20}'><@t.page 'name'/></th>
            <th type="checkbox" name="${name}[#index#].required" fieldClass="form-check-input" size="10"><@t.page 'required'/></th>
            <th type="text" name="${name}[#index#].defaultValue" size="10"><@t.page 'default_value'/></th>
            <th type="number" name="${name}[#index#].maxlength" size="10" fieldAttrs='{"min":1}'><@t.page 'maxlength'/></th>
            <th type="number" name="${name}[#index#].width" size="10" fieldAttrs='{"min":1,"style":"display:none"}'><@t.page 'width'/></th>
            <th type="number" name="${name}[#index#].height" size="10" fieldAttrs='{"min":1,"style":"display:none"}'><@t.page 'height'/></th>
            <th type="lookup" name="${name}[#index#].dictionaryName" lookupPk="dictionaryId" lookupUrl="cmsDictionary/lookup.html" lookupGroup="${name}[#index#]" fieldAttrs='{"readonly":"readonly","style":"display:none"}' size="10"><a href="cmsDictionary/list.html" target="navTab" rel="cmsDictionary/list"><@t.page 'dictionary'/></a></th>
            <th type="checkbox" name="${name}[#index#].multiple" fieldClass="form-check-input" size="10"><@t.page 'multiple_select'/></th>
            <th type="textarea" name="${name}[#index#].description" fieldAttrs='{"maxlength":80,"rows":2,"cols":30}'><@t.page 'description'/></th>
            <#if searchable>
                <th type="checkbox" name="${name}[#index#].searchable" size="10" fieldClass="form-check-input"><@t.page 'searchable'/></th>
            </#if>
            <#if sortable>
                <th type="enum" name="${name}[#index#].sortable" enumUrl="common/sortable.html" size="10" fieldAttrs='{"style":"display:none"}' fieldClass="form-check-input"><@t.page 'sortable'/></th>
            </#if>
            <th type="delAndSort" width="60"><@t.page 'operate'/></th>
        </tr>
    </thead>
    <tbody>
        <#list extendList as extend>
            <tr>
                <td>
                <#if !copy>
                    <input type="hidden" name="${name}[${extend?index}].id.extendId" value="${(extend.id.extendId)!}"/>
                </#if>
                    <input type="text" name="${name}[${extend?index}].id.code" value="${extend.id.code}" size="10" class="required letterstart"/>
                </td>
                <td>
                    <@extendsFieldType name+'['+extend?index+'].inputType' extend.inputType searchable/>
                </td>
                <td>
                    <input type="text" name="${name}[${extend?index}].name" value="${extend.name}" size="10" maxlength="20"/>
                </td>
                <td>
                    <input type="checkbox" name="${name}[${extend?index}].required" class="form-check-input"${extend.required?then(' checked="true"','')?no_esc}/>
                </td>
                <td>
                    <input type="text" name="${name}[${extend?index}].defaultValue" value="${(extend.defaultValue)!}" size="10"/>
                </td>
                <td>
                    <input type="number" name="${name}[${extend?index}].maxlength" min="1" value="${(extend.maxlength)!}"<#if maxlengthDisableTypes?seq_contains(extend.inputType)> style="display:none"</#if> size="10"/>
                </td>
                <td>
                    <input type="number" name="${name}[${extend?index}].width" min="1" value="${(extend.width)!}"<#if !sizeEnableTypes?seq_contains(extend.inputType)> style="display:none"</#if> size="10"/>
                </td>
                <td>
                    <input type="number" name="${name}[${extend?index}].height" min="1" value="${(extend.height)!}"<#if !sizeEnableTypes?seq_contains(extend.inputType)> style="display:none"</#if> size="10"/>
                </td>
                <td>
                    <@cms.dictionary id=extend.dictionaryId><#assign dictionary=object/></@cms.dictionary>
                    <input type="hidden" name="${name}[${extend?index}].dictionaryId" value="${(extend.dictionaryId)!}"/>
                    <input type="text" name="${name}[${extend?index}].dictionaryName" readonly="readonly" size="10" value="${(dictionary.name)!}"<#if 'dictionary'=extend.inputType> class="required"<#else> style="display:none"</#if>/>
                    <a class="btnLook" href="cmsDictionary/lookup.html" lookupGroup="${name}[${extend?index}]" width="1000" height="500"<#if 'dictionary'!=extend.inputType> style="display:none"</#if>><@t.page 'dictionary.select'/></a>
                </td>
                <td>
                    <input type="checkbox" name="${name}[${extend?index}].multiple" class="form-check-input"${extend.multiple?then(' checked="true"','')?no_esc}<#if !multipleEnableTypes?seq_contains(extend.inputType)> style="display:none"</#if>/>
                </td>
                <td>
                    <textarea type="text" name="${name}[${extend?index}].description" rows="2" cols="30" maxlength="80">${(extend.description)!}</textarea>
                </td>
                <#if searchable>
                    <td>
                        <input type="checkbox" name="${name}[${extend?index}].searchable" class="form-check-input" ${extend.searchable?then(' checked="true"','')?no_esc}/>
                    </td>
                </#if>
                <#if sortable>
                    <td>
                        <@extendsSortable name+"["+extend?index+"].sortable" extend.sortable/>
                    </td>
                </#if>
                <td>
                    <a href="javascript:;" class="icon-move"></a>
                    <a href="javascript:;" class="btnDel"><@t.page 'button.delete'/></a>
                </td>
            </tr>
        </#list>
    </tbody>
</table>
</#macro>