<?php
/* Smarty version 4.5.2, created on 2024-05-10 12:11:44
  from '/Users/nikolaimv/Sites/yzb.loc/admin/templates/views/blocks/blocks.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.2',
  'unifunc' => 'content_663dc8b04b2529_11836994',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '9cdd01157b5f4a0a6c1bb1adff31fafd04edace6' => 
    array (
      0 => '/Users/nikolaimv/Sites/yzb.loc/admin/templates/views/blocks/blocks.tpl',
      1 => 1711621956,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:module/show-by.tpl' => 1,
    'file:components/page-header.tpl' => 1,
    'file:components/selectors.tpl' => 1,
    'file:module/pagination.tpl' => 1,
  ),
),false)) {
function content_663dc8b04b2529_11836994 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/Users/nikolaimv/Sites/yzb.loc/includes/composer/vendor/smarty/smarty/libs/plugins/modifier.truncate.php','function'=>'smarty_modifier_truncate',),));
?>

	<!-- Page header -->
	<?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "buttons", null, null);?>
		<a class="btn btn-sm btn-primary" data-bs-popup="tooltip" title="Добавить" data-bs-placement="auto" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/block?action=edit<?php if ((isset($_smarty_tpl->tpl_vars['page']->value))) {?>&page=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['page']->value, ENT_QUOTES, 'UTF-8', true);
}
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['buildQueryString']->value, ENT_QUOTES, 'UTF-8', true);?>
"><i class="icon-plus3"></i></a>

	<?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

	<?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "breadcrumb", null, null);?>
		<a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/blocks" class="breadcrumb-item"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8', true);?>
</a>
	<?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

	<?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "showBy", null, null);?>
	    <?php $_smarty_tpl->_subTemplateRender("file:module/show-by.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('url'=>((string)$_smarty_tpl->tpl_vars['adminUrl']->value)."/blocks"), 0, false);
?>
	<?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

	<?php $_smarty_tpl->_subTemplateRender("file:components/page-header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('buttons'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'buttons'),'breadcrumb'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'breadcrumb'),'showBy'=>$_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'showBy')), 0, false);
?>
	<!-- /page header -->


	<!-- Content area -->
	<div class="content">

		<div class="row">
			<div class="col-md-12">
				<div class="card border shadow-sm">
	                <?php $_smarty_tpl->_subTemplateRender("file:components/selectors.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('filter'=>true,'url'=>((string)$_smarty_tpl->tpl_vars['adminUrl']->value)."/blocks",'filterDate'=>false), 0, false);
?>
				</div>

				<div class="card border shadow-sm">
					<div class="">
						<table class="table table-togglable table-striped table-hover" id="blocks">
							<thead>
							<tr>
								<th data-hide="ID" class="text-center" width="30">#</th>
								<th class="text-start gridjs-th-sort main-th-col-sortable" onclick="tableSort(this, '<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['module']->value, ENT_QUOTES, 'UTF-8', true);?>
'); return false;" data-sort-by="title" data-sort-order="<?php if ((isset($_smarty_tpl->tpl_vars['sortOrder']->value['column'])) && $_smarty_tpl->tpl_vars['sortOrder']->value['column'] == 'title') {
if ($_smarty_tpl->tpl_vars['sortOrder']->value['sort'] == 'asc') {?>desc<?php } else { ?>asc<?php }
} else { ?>asc<?php }?>">Заголовок <button class="gridjs-sort gridjs-sort-<?php if ((isset($_smarty_tpl->tpl_vars['sortOrder']->value['column'])) && $_smarty_tpl->tpl_vars['sortOrder']->value['column'] == 'title') {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['sortOrder']->value['sort'], ENT_QUOTES, 'UTF-8', true);
} else { ?>neutral<?php }?>"></button></th>
								<th class="text-start gridjs-th-sort main-th-col-sortable" onclick="tableSort(this, '<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['module']->value, ENT_QUOTES, 'UTF-8', true);?>
'); return false;" data-sort-by="sectionId" data-sort-order="<?php if ((isset($_smarty_tpl->tpl_vars['sortOrder']->value['column'])) && $_smarty_tpl->tpl_vars['sortOrder']->value['column'] == 'sectionId') {
if ($_smarty_tpl->tpl_vars['sortOrder']->value['sort'] == 'asc') {?>desc<?php } else { ?>asc<?php }
} else { ?>asc<?php }?>">Раздел <button class="gridjs-sort gridjs-sort-<?php if ((isset($_smarty_tpl->tpl_vars['sortOrder']->value['column'])) && $_smarty_tpl->tpl_vars['sortOrder']->value['column'] == 'sectionId') {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['sortOrder']->value['sort'], ENT_QUOTES, 'UTF-8', true);
} else { ?>neutral<?php }?>"></button></th>
								<th data-hide="phone" class="text-center">Статус</th>
								<th class="text-center text-muted" width="40"><i class="ph-check"></i></th>
							</tr>
							</thead>
	                        <?php if ($_smarty_tpl->tpl_vars['blocks']->value) {?>
								<tbody class="sortable">

	                            <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['blocks']->value, 'block', false, NULL, 'blocks', array (
));
$_smarty_tpl->tpl_vars['block']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['block']->value) {
$_smarty_tpl->tpl_vars['block']->do_else = false;
?>
									<tr id="block-<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);?>
" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);?>
" class="<?php if ($_smarty_tpl->tpl_vars['block']->value['status'] == 'H') {?>table-warning<?php }?>">
										<td class="text-center text-nowrap"><i class="ph-dots-six text-muted"></i></td>
										<td><b><?php echo smarty_modifier_truncate($_smarty_tpl->tpl_vars['block']->value['title'],75);?>
</b></td>
										<td class="text-left"><?php if ((isset($_smarty_tpl->tpl_vars['block']->value['section']))) {
echo htmlspecialchars((string)smarty_modifier_truncate($_smarty_tpl->tpl_vars['block']->value['section']['name'],25), ENT_QUOTES, 'UTF-8', true);
}?></td>
										<td class="text-center" id="status-<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);?>
"><?php echo $_smarty_tpl->tpl_vars['block']->value['statusName'];?>
</td>
										<td class="text-center">
											<div class="d-inline-flex">
												<a class="text-primary" data-bs-popup="tooltip" title="Редактировать" data-bs-placement="auto" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/block?action=edit&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);
if ((isset($_smarty_tpl->tpl_vars['page']->value))) {?>&page=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['page']->value, ENT_QUOTES, 'UTF-8', true);
}
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['buildQueryString']->value, ENT_QUOTES, 'UTF-8', true);?>
"><i class="ph-note-pencil me-2"></i></a>
												<div class="list-icons-item dropdown">
													<a class="text-body" data-bs-toggle="dropdown"><i class="ph-list"></i></a>
													<div class="dropdown-menu dropdown-menu-end">
														<a class="dropdown-item" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/block?action=edit&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);
if ((isset($_smarty_tpl->tpl_vars['page']->value))) {?>&page=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['page']->value, ENT_QUOTES, 'UTF-8', true);
}
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['buildQueryString']->value, ENT_QUOTES, 'UTF-8', true);?>
"><i class="ph-note-pencil me-2"></i> Редактировать</a>
														<button class="dropdown-item ajax_action" data-module="blocks" data-action="status" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);?>
"><i class="<?php if ($_smarty_tpl->tpl_vars['block']->value['status'] == 'V') {?>ph-eye<?php } else { ?>ph-eye-slash<?php }?> me-2"></i> Статус</button>
														<div class="dropdown-divider"></div>
														<button class="dropdown-item text-danger" onclick="newRemove(<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['blockId'], ENT_QUOTES, 'UTF-8', true);?>
, '<?php echo htmlspecialchars((string)htmlspecialchars((string)$_smarty_tpl->tpl_vars['block']->value['title'], ENT_QUOTES, 'UTF-8', true), ENT_QUOTES, 'UTF-8', true);?>
', 'blocks');"><i class="ph-trash me-2"></i> Удалить</button>
													</div>
												</div>
											</div>
										</td>
									</tr>
	                            <?php
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?>

								</tbody>
	                        <?php } else { ?>
								<tbody><tr class="odd"><td class="text-center" colspan="8">- Не найдено -</td></tr></tbody>
	                        <?php }?>
						</table>
					</div>

	                <?php $_smarty_tpl->_subTemplateRender("file:module/pagination.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('url'=>((string)$_smarty_tpl->tpl_vars['adminUrl']->value)."/blocks",'params'=>((string)$_smarty_tpl->tpl_vars['buildQueryString']->value)), 0, false);
?>
				</div>
			</div>

		</div>
	</div>

	<?php echo '<script'; ?>
>

    $(document).ready(function () {
      
        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['saved']))) {?> new Noty({ text: 'Блок сохранен', type: 'success', timeout: 1500 }).show(); <?php }?>
        
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['access_denied']))) {?> new Noty({ text: 'Доступ запрещен.', type: 'error', timeout: 2500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['not_saved']))) {?>   new Noty({ text: 'Блок не сохранен', type: 'error', timeout: 2500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['no_sections']))) {?> new Noty({ text: 'Перед добавлением контент, добавьте хотя бы один раздел.', type: 'error', timeout: 2500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['article_not_found']))) {?> new Noty({ text: 'Блок не найден', type: 'error', timeout: 2500 }).show(); <?php }?>

    });


    function notFound(){
        new Noty({ text: 'Блок не найден', layout: 'topRight', type: 'error', timeout: 1500 }).show();
    }
    function statusError(){
        new Noty({ text: 'ошибка при изменение статуса', layout: 'topRight', type: 'error', timeout: 2500 }).show();
    }


    $(document).on('click', '.sortable_save_button', function () {
        var ids = new Array();
        $('.sortable tr').each(function () {
            console.log($(this).attr('data-id'))

            ids.push($(this).attr('data-id'));
        })
        $.post( "<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/blocks?action=reorder", { ids : ids }, function( data ) {
            $('.sortable_footer_navbar').removeClass('show');
            // location.reload();
        });
    })
    $(document).on('click', '.sortable_cancel_button', function () {
        $('.sortable_footer_navbar').removeClass('show');
        location.reload();
    })
<?php echo '</script'; ?>
>


<?php }
}
