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

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.2',
  'unifunc' => 'content_663dc88bbee374_70683116',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'f7ffe9e3f791b793797dd19678dba88249e8825b' => 
    array (
      0 => '/Users/nikolaimv/Sites/yzb.loc/admin/templates/views/sections/sections.tpl',
      1 => 1698671868,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:module/show-by.tpl' => 1,
    'file:components/page-header.tpl' => 1,
    'file:module/pagination.tpl' => 1,
  ),
),false)) {
function content_663dc88bbee374_70683116 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/Users/nikolaimv/Sites/yzb.loc/includes/composer/vendor/smarty/smarty/libs/plugins/function.html_options.php','function'=>'smarty_function_html_options',),1=>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-primary btn-icon btn-sm"
		   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);?>
/section?action=add<?php if (!empty($_smarty_tpl->tpl_vars['page']->value)) {?>&page=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['page']->value, ENT_QUOTES, 'UTF-8', true);
}
if (!empty($_smarty_tpl->tpl_vars['parentId']->value)) {?>&parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parentId']->value, ENT_QUOTES, 'UTF-8', true);
}?>">
			<i class="ph-plus"></i>
		</a>
    <?php $_smarty_tpl->smarty->ext->_capture->close($_smarty_tpl);?>

    <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "breadcrumb", null, null);?>
		<a class="breadcrumb-item" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['title']->value, ENT_QUOTES, 'UTF-8', true);?>
 </a>
        <?php if ((isset($_smarty_tpl->tpl_vars['parent']->value))) {?>
			<a class="breadcrumb-item" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections"> Наверх в корень</a>
            <?php if ((isset($_smarty_tpl->tpl_vars['parent']->value['parentId']))) {?>
				<a class="breadcrumb-item" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections?parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parent']->value['parentId'], ENT_QUOTES, 'UTF-8', true);?>
"><?php if ((isset($_smarty_tpl->tpl_vars['parent']->value['name']))) {?> <?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parent']->value['name'], ENT_QUOTES, 'UTF-8', true);
}?></a>
            <?php }?>
        <?php }?>
    <?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)."/sections"), 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);
?>

	<div class="content">
		<div class="row">
			<div class="col-md-12">

                <?php if ((isset($_smarty_tpl->tpl_vars['action']->value)) && $_smarty_tpl->tpl_vars['action']->value == 'confirmDelete') {?>
					<div class="card border shadow-sm">
						<div class="alert bg-danger text-white alert-dismissible m-0">
							<span class="font-weight-semibold">Удаляется раздел "<?php if ((isset($_smarty_tpl->tpl_vars['section']->value['name']))) {
echo $_smarty_tpl->tpl_vars['section']->value['name'];
}?>"</span><br />
							<span>Вы уверены, что хотите удалить раздел <?php if ((isset($_smarty_tpl->tpl_vars['section']->value['hasSubsections'])) || (isset($_smarty_tpl->tpl_vars['section']->value['hasArticles']))) {?>и выполнить выбранные действия<?php }?>?</span>
						</div>
					</div>
					<div class="card border shadow-sm">
						<form action="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections" method="post" id="confirmDelete">
                            <?php if (!empty($_smarty_tpl->tpl_vars['section']->value['hasSubsections']) || !empty($_smarty_tpl->tpl_vars['section']->value['hasArticles'])) {?>
							<div class="card-body">
								<div class="row">
									<?php if ((isset($_smarty_tpl->tpl_vars['subsectionOptions']->value))) {?>
										<div class="<?php if ((isset($_smarty_tpl->tpl_vars['articleOptions']->value))) {?>col-md-6<?php } else { ?>col-md-12<?php }?>">
											<div class="form-group mb-2">
												<label class="form-label is-visible">Подразделы и их контент</label>
												<?php echo smarty_function_html_options(array('options'=>$_smarty_tpl->tpl_vars['subsectionOptions']->value,'name'=>"param[moveSubsectionsTo]",'class'=>"form-control form-control-sm select"),$_smarty_tpl);?>

											</div>
										</div>
									<?php }?>
									<?php if ((isset($_smarty_tpl->tpl_vars['articleOptions']->value))) {?>
										<div class="<?php if ((isset($_smarty_tpl->tpl_vars['subsectionOptions']->value))) {?>col-md-6<?php } else { ?>col-md-12<?php }?>">
											<div class="form-group">
												<label class="form-label is-visible">Контент</label>
												<?php echo smarty_function_html_options(array('options'=>$_smarty_tpl->tpl_vars['articleOptions']->value,'name'=>"param[moveArticlesTo]",'class'=>"form-control form-control-sm select"),$_smarty_tpl);?>

											</div>
										</div>
									<?php }?>
								</div>
							</div>
                            <?php }?>
							<div class="card-footer bg-white d-sm-flex justify-content-sm-between align-items-sm-center">
								<input type="hidden" name="id" value="<?php if ((isset($_smarty_tpl->tpl_vars['section']->value['sectionId']))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);
}?>" />
								<input type="hidden" name="parentId" value="<?php if ((isset($_smarty_tpl->tpl_vars['parentId']->value))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parentId']->value, ENT_QUOTES, 'UTF-8', true);
}?>" />
								<button class="btn btn-sm btn-primary" type="submit" name="action" value="deleteConfirmed">Да</button>
								<a class="btn btn-sm btn-light" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections?parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parentId']->value, ENT_QUOTES, 'UTF-8', true);?>
">Отменить</a>
							</div>
						</form>
					</div>

                <?php } else { ?>

					<div class="card border shadow-sm">
						<div class="">
							<table class="table table-togglable table-xs table-striped table-hover" id="sections">
								<thead>
								<tr>
									<th data-hide="phone, tablet" class="text-center" width="30">#</th>
									<th data-toggle="true" class="">Заголовок</th>
									<th data-hide="phone, tablet">Альтернативное имя</th>
									<th data-hide="phone, tablet">Путь</th>
									<th data-hide="phone, tablet" width="80">Тип</th>
									<th data-hide="phone, tablet" width="140">Тип контента</th>
									<th class="text-center text-muted" width="50"><i class="ph-check"></i></th>
								</tr>
								</thead>
                                <?php if ((isset($_smarty_tpl->tpl_vars['sections']->value))) {?>
									<tbody class="sortable">
                                    <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['sections']->value, 'section', false, NULL, 'sections', array (
));
$_smarty_tpl->tpl_vars['section']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['section']->value) {
$_smarty_tpl->tpl_vars['section']->do_else = false;
?>
										<tr id="section-<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);?>
" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);?>
" class="<?php if ($_smarty_tpl->tpl_vars['section']->value['status'] == 'H') {?>table-warning<?php }?>">
											<td class="text-center text-nowrap"><i class="ph-dots-six text-muted" data-bs-popup="tooltip" title="Переместить" data-bs-placement="auto"></i></td>
											<td class="text-nowrap">
                                                <?php if (!empty($_smarty_tpl->tpl_vars['section']->value['hasSubsections'])) {?>
													<a data-bs-popup="tooltip" title="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
" data-bs-placement="auto" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections?parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);?>
" style="border-bottom: 1px dashed;"><?php echo htmlspecialchars((string)smarty_modifier_truncate(preg_replace('!<[^>]*?>!', ' ', (string) $_smarty_tpl->tpl_vars['section']->value['name']),25), ENT_QUOTES, 'UTF-8', true);?>
</a>
                                                <?php } else { ?>
													<span data-bs-popup="tooltip" title="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
" data-bs-placement="auto"><?php echo htmlspecialchars((string)smarty_modifier_truncate(preg_replace('!<[^>]*?>!', ' ', (string) $_smarty_tpl->tpl_vars['section']->value['name']),25), ENT_QUOTES, 'UTF-8', true);?>
</span>
                                                <?php }?>
											</td>
											<td class="text-nowrap"><span data-bs-popup="tooltip" title="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['alias'], ENT_QUOTES, 'UTF-8', true);?>
" data-bs-placement="auto"><?php echo htmlspecialchars((string)smarty_modifier_truncate(preg_replace('!<[^>]*?>!', ' ', (string) $_smarty_tpl->tpl_vars['section']->value['alias']),25), ENT_QUOTES, 'UTF-8', true);?>
</span></td>
											<td class="text-nowrap"><a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['url'], ENT_QUOTES, 'UTF-8', true);?>
" data-bs-popup="tooltip" title="Посмотреть" data-bs-placement="auto" target="_blank"><?php if ($_smarty_tpl->tpl_vars['section']->value['fileName'] == 'index') {?>/<?php } else { ?>/<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['fileName'], ENT_QUOTES, 'UTF-8', true);?>
/<?php }?></a></td>
											<td class="text-nowrap"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['typeName'], ENT_QUOTES, 'UTF-8', true);?>
</td>
											<td class="text-nowrap"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['typeContentName'], ENT_QUOTES, 'UTF-8', true);?>
</td>
											<td class="text-end">
												<div class="d-inline-flex">
													<div class="text-body">
														<div class="form-check form-switch" data-bs-popup="tooltip" title="Добавить или скрыть в основном меню" data-bs-placement="auto">
															<input type="checkbox" class="form-check-input form-check-input-success top_menu" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);?>
" <?php if ($_smarty_tpl->tpl_vars['section']->value['topMenu'] == '1') {?>checked<?php }?>>
														</div>
													</div>
													<a class="text-primary mx-2" 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);?>
/section?action=edit&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);
if ($_smarty_tpl->tpl_vars['parentId']->value) {?>&parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parentId']->value, 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);
}?>"><i class="ph-note-pencil"></i></a>
													<div class="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);?>
/section?action=edit&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);
if ($_smarty_tpl->tpl_vars['parentId']->value) {?>&parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parentId']->value, 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);
}?>"><i class="ph-note-pencil me-2"></i> Редактировать</a>
															<button class="dropdown-item ajax_action" data-module="sections" data-action="status" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);?>
"><i class="<?php if ($_smarty_tpl->tpl_vars['section']->value['status'] == 'V') {?>ph-eye<?php } else { ?>ph-eye-slash<?php }?> me-2"></i> Статус</button>
                                                            <?php if ($_smarty_tpl->tpl_vars['section']->value['fileName'] != 'index') {?>
																<div class="dropdown-divider"></div>
																<a class="dropdown-item text-danger" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections?action=confirmDelete&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['sectionId'], ENT_QUOTES, 'UTF-8', true);
if ($_smarty_tpl->tpl_vars['parentId']->value) {?>&parentId=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['parentId']->value, ENT_QUOTES, 'UTF-8', true);
}
if (!empty($_smarty_tpl->tpl_vars['page']->value)) {?>&page=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['page']->value, ENT_QUOTES, 'UTF-8', true);
}?>"><i class="ph-trash me-2"></i> Удалить</a>
                                                            <?php }?>
														</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 ob_start();
if ($_smarty_tpl->tpl_vars['parentId']->value) {
echo "&parentId=";
echo (string)$_smarty_tpl->tpl_vars['parentId']->value;
}
$_prefixVariable1=ob_get_clean();
$_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)."/sections",'params'=>$_prefixVariable1), 0, false);
?>
					</div>

                <?php }?>
			</div>
		</div>
	</div>

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

	    $(document).ready(function () {

	        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['not_saved']))) {?> new Noty({ text: 'Раздел «<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
» НЕ сохранен.', type: 'error' }).show();<?php }?>
	        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['section_not_found']))) {?> new Noty({ text: 'Раздел не найден.', type: 'error' }).show(); <?php }?>

	        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['saved']))) {?> new Noty({ text: 'Раздел «<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
» сохранен.', type: 'success' }).show(); <?php }?>
	        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['deleted']))) {?> new Noty({ text: 'Раздел «<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['section']->value['name'], ENT_QUOTES, 'UTF-8', true);?>
» удален.', type: 'success' }).show(); <?php }?>
	        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['sorted']))) {?> new Noty({ text: 'Разделы отсортированы.', type: 'success' }).show(); <?php }?>

	    });

	    function moveUpMessage(){ new Noty({ text: 'Раздел перемещен вверх.', type: 'warning' }).show(); }
	    function moveDownMessage(){ new Noty({ text: 'Раздел перемещен вниз.', layout: 'topRight', type: 'warning' }).show(); }
	    function topMenuMessage(){ new Noty({ text: 'Раздел добавлен в главное меню.', type: 'warning' }).show(); }
	    function downMenuMessage(){ new Noty({ text: 'Раздел удален из главного меню.', type: 'warning' }).show(); }
	    function sectionVisibleMessage(){ new Noty({ text: 'Раздел виден.', type: 'warning' }).show(); }
	    function sectionHiddenMessage(){ new Noty({ text: 'Раздел скрыт.', type: 'warning' }).show(); }


	    $(document).on('click', '.top_menu', function() {
	        var id = $(this).attr("data-id");
	        $.post("<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections?action=menu", { id: id }, function(data){
	            console.log(data.check);
	            if (data.check === 1) {
	                new Noty({ text: 'Раздел добавлен в главное меню. 👍', layout: 'topCenter', type: 'warning' }).show();
	            } else{
	                new Noty({ text: 'Раздел удален из главного меню. 👍', layout: 'topCenter', type: 'warning' }).show();
	            }
	        }, 'json');
	    });

	    $(document).on('click', '.sortable_save_button', function () {
	        var sectionIds = new Array();
	        $('.sortable tr').each(function () {
		        sectionIds.push($(this).attr('data-id'));
	        })
	        $.post( "<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/sections?action=reorder", { sectionIds : sectionIds }, 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 }
}
