
	<!-- Page header -->
	{capture name="buttons"}
		<button type="button" class="btn btn-sm btn-primary clear_log"><i class="far fa-fw fa-trash-alt"></i> Очистить лог</button>
	{/capture}
	{capture name="breadcrumb"}
		<a href="{$adminUrl}/syserrors" class="breadcrumb-item">{if isset($title)}{$title}{/if}</a>
	{/capture}

	{capture name="showBy"}
	{/capture}

	{include file="components/page-header.tpl" buttons=$smarty.capture.buttons breadcrumb=$smarty.capture.breadcrumb showBy=$smarty.capture.showBy}
	<!-- /page header -->

	<div class="content">
	    <div class="row">
	        <div class="col-md-12">
	            <div class="card">
		            <div class="">
		                <table class="table table-togglable table-striped table-hover" id="errors">
		                    <thead>
		                        <tr>
		                            <th data-toggle="true">Ошибка</th>
		                        </tr>
		                    </thead>
		                    {if !empty($error)}
							<tbody>
								{foreach from=$error item=e}
								<tr>
									<td>{$e}</td>
								</tr>
								{/foreach}
							</tbody>
							{else}
							<tbody>
								<tr>
									<td colspan="4" class="text-center">В Логе нет записей.</td>
								</tr>
							</tbody>
							{/if}
		                </table>
		            </div>
	            </div>
	        </div>

	    </div>
	</div>


	<script>
        $(document).on('click', '.clear_log', function () {
            $.post( "{$adminUrl}/syserrors", { action : "clear" }, function( response ) {
                new Noty({ text: response.message, type: response.type, timeout: 1500 }).show();
                if (response.status == 200) {
                    var myTable = document.getElementById("errors");
                    for (var a = myTable.rows.length - 1; a > 0; a--) {
                        myTable.deleteRow(a)
                    }
                }
            });
        })

	</script>


