{include file="./index_top.tpl"}
<div align=center>
    <br>{$lang.Settings} {$lang.To_system_messages}<span class='help_bt' h_id='Message_system_settings'></span><br><br>
    <form action="edit_messages.php?sel=save" method="post">
        {if $sel eq 'saved'}<span style="color:green">{$lang.succes_settings_save}</span><br><br>{/if}
        <table align="center" cellspacing="0">
            <tr>
                <td style="border-bottom: 1px solid black">&nbsp;</td>
                <td style="border-bottom: 1px solid black; padding: 0px 7px;">{$lang.Access}<span class="help_bt" h_id="Message_access"></span></td>
                <td style="border-bottom: 1px solid black; padding: 0px 7px;">{$lang.Send_by_email}<span class="help_bt" h_id="Message_Send_by_email"></span></td>
                <td style="border-bottom: 1px solid black; padding: 0px 7px;">{$lang.notify_on}<span class="help_bt" h_id="Message_notify_on"></span></td>
            </tr>
            <tr>
                <td style="border-bottom: 1px solid black">&nbsp;</td>
                <td style="border-bottom: 1px solid black; text-align: center;"><input type="checkbox" name="setup_all"
                                                                                       onclick="if (this.checked) { $('.msg_status_chk').attr('checked', true); } else { $('.msg_status_chk').attr('checked', false); }"/>
                </td>
                <td style="border-bottom: 1px solid black; text-align: center;"><input type="checkbox" name="setup_all"
                                                                                       onclick="if (this.checked) { $('.email_status_chk').attr('checked', true); } else { $('.email_status_chk').attr('checked', false); }"/>
                </td>
                <td style="border-bottom: 1px solid black; text-align: center;"><input type="checkbox" name="setup_all"
                                                                                       onclick="if (this.checked) { $('.notify_status_chk').attr('checked', true); } else { $('.notify_status_chk').attr('checked', false); }"/>
                </td>
            </tr>
            {foreach from=$group_list item=one_group}
                <tr>
                    <td>{$one_group.name}</td>
                    <td style="text-align: center;"><input type="checkbox" class="msg_status_chk"
                                                           name="message_status[]"
                                                           value="{$one_group.id}"{if $one_group.access} checked{/if} />
                    </td>
                    <td style="text-align: center;"><input type="checkbox" class="email_status_chk"
                                                           name="email_status[]"
                                                           value="{$one_group.id}"{if $one_group.email_on} checked{/if} />
                    </td>
                    <td style="text-align: center;"><input type="checkbox" class="notify_status_chk"
                                                           name="notify_status[]"
                                                           value="{$one_group.id}"{if $one_group.notify_on} checked{/if} />
                    </td>
                </tr>
            {/foreach}
        </table>
        <br/><br/>
        <input type=hidden name="message_status[]">
        <input type=hidden name="email_status[]">
        <input type=hidden value="{$back_url_encoded}" name="back_url">
        <input type=hidden value="{$csrf}" name="csrf">
        <input class="btn btn-default btn-sm" type=submit value="{$lang.Save}" name="save">
        <input class="btn btn-default btn-sm" type=button onclick="location.href='{if $back_url}{$back_url}{else}edit_add.php{/if}'"
               value="{$lang.Cancel}">
        <br/><br/>
    </form>
</div>