{include file="./index_top.tpl"}
<div align=center><br>{$lang.Edit_template} &quot;{$search_template.template_name}&quot; {$lang.of_table}
    &quot;{$name_table}&quot;<br><br></div>
<form action="search_templates.php?template_id={$search_template.id}" method="post">
    <table align="center" border=0 cellpadding=3 cellspacing=0>
        <tr>
            <td width=180 align=right>{$lang.Template_name}<span class='help_bt' h_id='search_template_name'></span>:
            </td>
            <td><input type=text name="template_name" id="template_name" value="{$search_template.template_name}"
                       size="50"/></td>
        </tr>
        {if $user.group_id eq 1 or $user.sub_admin}
            <tr>
                <td width=180 align=right>{$lang.global_search_template}<span class='help_bt'
                                                                              h_id='search_template_global'></span>:
                </td>
                <td><input type="checkbox" name="global_template" id="global_template"
                           value="1"{if $search_template.def_template eq 2} checked{/if}
                           onclick="if (this.checked) { document.getElementById('def_template_line').style.display='none'; } else { document.getElementById('def_template_line').style.display='' }"/>
                </td>
            </tr>
        {/if}
        {if $search_template.user_id eq $user.id}
            <tbody id="def_template_line"{if $search_template.def_template eq 2} style="display: none"{/if}>
            <tr>
                <td width=180 align=right>{$lang.Default}<span class='help_bt' h_id='search_template_default'></span>:
                </td>
                <td><input type="checkbox" name="def_template" id="def_template"
                           value="1"{if $search_template.def_template eq 1} checked{/if} /></td>
            </tr>
            </tbody>
        {/if}
        <tr>
            <td colspan=2 align=center>
                <br>
                <input type=submit name=save value="{$lang.Save}"
                       onclick="if(!document.getElementById('template_name').value.replace(/ /g,'')) { jalert('{$lang.Enter_temp_name}!'); return false; }">
                <input type=button
                       onclick="location.href='search_templates.php?table={$table_id}{if $back_url}&back_url={$smarty.get.back_url}{/if}'"
                       value="{$lang.Cancel}">
                <input type=hidden name=table value="{$table_id}">
            </td>
        </tr>
    </table>
    <input type='hidden' name=back_url value="{$base64_back_url}">
    <input type='hidden' name=csrf value="{$csrf}">
</form><br>