{include file="./index_top.tpl"}
<div align=center>
    <br>{$lang.notify_of_table} "{$name_table}"<span class='help_bt' h_id='Reminders'></span><br><br>
    {include file="./conf_nav.tpl"}
    <p style="font-size:14px;">
        {if $archive}<a style="font-size:14px;" href="edit_tip.php?table={$table_id}">{/if}
            {$lang.active}
        {if $archive}</a>{/if}
        /
        {if !$archive}
            {if $has_archive}
                <a style="font-size:14px;" href="edit_tip.php?table={$table_id}&archive">
            {else}
                <span style="color:gray" title="{$lang.Empty_archive}">
            {/if}
        {/if}
            {$lang.archive}
        {if !$archive}{if $has_archive}</a>{else}</span>{/if}{/if}
    </p>
    <script>
        let ajaxObj = new XMLHTTP("edit_tip.php");
        ajaxObj.format = 0;
        ajaxObj.method = "POST";
        function switchOnObjectTip(tip_id) {
            $('#switch-on-btn_'+tip_id).toggleClass('switch-on');
            $('#switch-on-btn_'+tip_id).trigger('on.switch');
            ajaxObj.call('tip_id='+tip_id+'&sel=disable&enbl='+($('#switch-on-btn_'+tip_id).hasClass('switch-on')?1:0)+'&csrf={$csrf}',()=>{});
        }
    </script>
    <table border=0 cellpadding=3>
        {foreach from=$all_tips item=one_tip}
            {if $user.group_id==1 || $user.sub_admin_rights.tables.{$table_id}>=2 || $one_tip.owner_id==$user.group_id}
            {if $config.display_protected_elements || $one_tip.blocked != 2}
                <tr>
                    <td>
                        {if $user.group_id==1 || $user.sub_admin_rights.tables.{$table_id}==2 || $one_tip.owner_id==$user.group_id}
                        {if !$one_tip.blocked}
                        {if !$archive}
                            <a class='href_post'
                                href="edit_tip.php?table={$table_id}&tip_id={$one_tip.id}&sel=archive"><img
                                        alt="{$lang.into_archive}" title="{$lang.send_in_archive}"
                                        src="images/b_archive.png" border=0></a>
                        {else}
                            <a class='href_post'
                                href="edit_tip.php?table={$table_id}&mode={$mode}&admin&archive&tip_id={$one_tip.id}&sel=restore"><img
                                        alt="{$lang.restore}" title="{$lang.restore_from_archive}"
                                        src="images/b_restore.png" border=0></a>
                        {/if}
                        {/if}
                        {/if}
                    </td>
                    <td>{if ($user.group_id==1 || ($user.sub_admin_rights.tables.{$table_id}==2 && $user.sub_admin_rights.allow_del) || $one_tip.owner_id==$user.group_id) && !$one_tip.blocked}
                            <a class='href_post'
                               href="edit_tip.php?table={$table_id}&tip={$one_tip.id}&delete{if $back_url}&back_url={$base64_back_url}{/if}"
                               onClick="return href_post=jconfirm('{$lang.alert_delete_tip}', this);"><img
                                    alt="{$lang.delete}" title="{$lang.Delete_tip}" src="images/b_drop.png" border=0>
                            </a>{/if}</td>
                    {if !$archive}
                        <td>{if $one_tip.blocked != 2 && !$add_blocked && ($all_modules.pro_tariff || $one_tip.construct)}<a class='href_post'
                            href="edit_tip.php?table={$table_id}&tip={$one_tip.id}&amp;copy{if $back_url}&back_url={$base64_current_url}{/if}"
                            onClick="if (copy_name=prompt('{$lang.Copy_as}','{$one_tip.name} {$lang['(copy)']}')) {ldelim}this.href=this.href+'&amp;copy='+copy_name; href_post=true;{rdelim} else href_post=false;"><img
                                        alt="{$lang.copy}" title="{$lang.Copy_tip}" src="images/b_copy.png" border=0></a>{/if}
                        </td>
                        <td>
                            {if !$one_tip.blocked}
                            <div style="left: 0; top: 2px; margin: 0 5px;"
                                onclick="switchOnObjectTip('{$one_tip.id}')"
                                class="switch-btn {if !$one_tip.disabled}switch-on{/if}"
                                id="switch-on-btn_{$one_tip.id}"><div></div></div>
                            {/if}
                        </td>
                    {/if}
                    <td>
                        {if ($user.group_id==1 || $user.sub_admin_rights.tables.{$table_id}>=2 || $one_tip.owner_id==$user.group_id) && $one_tip.blocked != 2}
                            <a class="cb_field_title__link {if $one_tip.blocked}gray_link{/if}" href="edit_tip.php?table={$table_id}&tip={$one_tip.id}{if $back_url}&back_url={$smarty.get.back_url}{/if}">
                                <b>{$one_tip.name}</b>
                            </a>
                        {else}
                           <b style="color:gray;">{$one_tip.name}</b>
                        {/if}
                    </td>
                    <td style="padding-left: 30px;">
                        {if $one_tip.construct}<span style="color: grey; font-style: italic;">{$lang.construct}</span>{/if}
                    </td>
                    {if $one_tip.protected}<td><img src="images/lock.svg" style="width:13px" title="{$one_tip.protect_comment}"></td>{/if}
                </tr>
            {/if}
            {/if}
        {foreachelse}
            <tr>
                <td>{$lang.No_tips}</td>
            </tr>
        {/foreach}
    </table>
    <br>{if !$archive && !$add_blocked}<input class="btn btn-default btn-sm" type=button value="{$lang.Add_notify}"
               onClick="location.href='edit_tip.php?table={$table_id}&tip=-1{if $back_url}&back_url={$smarty.get.back_url}{/if}';">{/if}<br><br>
    <br><a href="{if $back_url}{$back_url}{else}edit_tabrep.php?cat={$cat_id}{/if}">{$lang.return_to_tables}</a> | <a href="fields.php?table={$table_id}" target="_blank">{$lang.view_table}</a><br><br>
</div>

<script src="themes/clientbase/js/cut_title_field.js"></script>
