{include file="./index_top.tpl"}
<div align=center>
    <br>{$lang.Search_templates} {$lang.of_table} &quot;{$name_table}&quot;<br><br>
    <form action="search_templates.php?table={$table_id}" method="post">
        <table class='sortableTable'>
            {foreach from=$templates_list item=one_template}
                <tr>
                    <td><span class="draggableImg">&nbsp;</span></td>
                    <td>{if $user.id eq $one_template.user_id and $one_template.def_template neq 2}<input type=text
                                                                                                          size=1
                                                                                                          name=num[{$one_template.id}]
                                                                                                          value={$one_template.num_order}>{/if}
                    </td>
                    <td>{if $user.id eq $one_template.user_id or ($one_template.def_template eq 2 and $user.group_id eq 1)}
                            <a class='href_post'
                               href="search_templates.php?table={$table_id}&template_id={$one_template.id}&delete{if $back_url}&back_url={$base64_current_url}{/if}"
                               onclick="return href_post=jconfirm('{$lang.alert_delete_template}', this);"><img
                                    alt="{$lang.delete}" title="{$lang.Delete}" src="images/b_drop.png" border=0>
                            </a>{/if}</td>
                    <td>{if $user.id eq $one_template.user_id or ($one_template.def_template eq 2 and $user.group_id eq 1)}
                            <a
                            href="search_templates.php?table={$table_id}&template_id={$one_template.id}{if $back_url}&back_url={$smarty.get.back_url}{/if}">
                            <img alt="" title="{$lang.Edit_template}" src="images/b_edit.png" border="0"/></a>{/if}</td>
                    <td>
                        <a href="fields.php?table={$table_id}&search_template_id={$one_template.id}"><b>{$one_template.template_name}</b></a>
                    </td>
                </tr>
                {foreachelse}
                <tr>
                    <td>{$lang.No_templates}</td>
                </tr>
            {/foreach}
        </table>
        <br>
        {if $templates_list}<input class="btn btn-default btn-sm" type=submit value="{$lang.Refresh_range}"> {/if}
        <input type=hidden name=csrf value={$csrf}>
        <input type=hidden name=back_url value='{$base64_back_url}'>
    </form>
    <br>
    <br><a href="{if $back_url}{$back_url}{else}fields.php?table={$table_id}{/if}">{$lang.Return}</a><br><br>
</div>