2026-02-14 19:50:25 +03:00
{ * Вкладки * }
{ capture name = tabs }
<li class="active"><a href="index.php?module=ServicesAdmin">Услуги</a></li>
<li><a href="index.php?module=ServicesMenuAdmin">Меню услуг</a></li>
2026-02-16 21:43:07 +03:00
<li><a href=" { url module = RepairsAdmin id = null page = null } ">Автосервис</a></li>
2026-02-14 19:50:25 +03:00
{ /capture }
{ * Title * }
{ $meta_title = $menu - > name scope = parent }
{ * Поиск * }
<form id="search" method="get">
<input type="hidden" name="module" value="ServicesAdmin">
<input type="hidden" name="filter" value=' { $filter } '>
<input type="hidden" name="brand_id" value=" { $brand_id } ">
<input type="hidden" name="parent" value=" { $parent } ">
<input class="search" type="text" name="keyword" value=" { $keyword | escape } ">
<input class="search_button" type="submit" value="">
</form>
{ * Заголовок * }
<div id="header">
{ if $keyword & & $services_count > 0 }
<h1> { $services_count | plural : 'Нашлась' : 'Нашлось' : 'Нашлись' } { $services_count }
{ $services_count | plural : 'услуга' : 'услуг' : 'услуги' } </h1>
{ elseif $services_count > 0 }
<h1> { $services_count } { $services_count | plural : 'услуга' : 'услуг' : 'услуги' } </h1>
<a class="add" href=" { url module = ServiceAdmin return = $smarty.server.REQUEST_URI } ">Добавить услугу</a>
{ else }
<h1>Нет услуг</h1>
<a class="add" href=" { url module = ServiceAdmin return = $smarty.server.REQUEST_URI } ">Добавить услугу</a>
{ /if }
</div>
<style>
</style>
{ if $services }
<div id="main_list" class="">
{ include file = 'pagination.tpl' }
<form id="list_form" method="post">
<input type="hidden" name="session_id" value=" { $smarty.session.id } ">
<div id="list" class="pb-3">
{ foreach $services as $service }
<div class="row { cycle values = "even,odd" } ">
<div class="checkbox cell pr-1">
<input type="checkbox" name="check[]" value=" { $service - > id } ">
</div>
<div class="cell">
<a href="index.php?module=ServiceAdmin&id= { $service - > id } "><b> { $service - > header | escape } </b></a>
</div>
<div class="icons cell">
<a class="preview" title="Предпросмотр в новом окне" href="../ { $root_url } { $service - > url } /"
target="_blank"></a>
<a class="enable { if $service - > visible } a-visible { else } a-invisible { /if } " title="Активна"
href="#"></a>
{ if ! $service - > has_children }
<a class="delete" title="Удалить" href="#"></a>
{ /if }
</div>
<div class="clear"></div>
</div>
{ /foreach }
</div>
<div id="action">
<label id="check_all" class="dash_link">Выбрать все</label>
<span id="select">
<select name="action">
<option value="enable">Сделать видимыми</option>
<option value="disable">Сделать невидимыми</option>
<option value="delete">Удалить</option>
</select>
</span>
<input id="apply_action" class="button_green" type="submit" value="Применить">
</div>
</form>
{ include file = 'pagination.tpl' }
</div>
{ else }
Нет услуг
{ /if }
{ * Правое меню * }
<div id="right_menu">
<h3 class="mb-3 mt-2">Фильтр услуг</h3>
<ul id="service_filter">
<li { if ! $filter } class="selected" { /if } >
<a href=" { url page = null filter = null } ">В с е услуги</a>
</li>
<li { if $filter = = 'branded' } class="selected" { /if } >
<a href=" { url page = null filter = 'branded' } " class="d-inline-flex align-items-center p-1">
Только брендовые
</a>
</li>
<li { if $filter = = 'home' } class="selected" { /if } >
<a href=" { url page = null filter = 'home' } " class="d-inline-flex align-items-center p-1">
Услуги на главной
</a>
</li>
<li { if $filter = = 'main' } class="selected" { /if } >
<a href=" { url page = null filter = 'main' } " class="d-inline-flex align-items-center p-1">
Главные услуги
</a>
</li>
<li { if $filter = = 'enabled' } class="selected" { /if } >
<a href=" { url page = null filter = 'enabled' } " class="d-inline-flex align-items-center p-1">
<img class="mr-1" src="design/images/lightbulb.png">Активные
</a>
</li>
<li { if $filter = = 'disabled' } class="selected" { /if } >
<a href=" { url page = null filter = 'disabled' } " class="d-inline-flex align-items-center p-1">
<img class="mr-1" src="design/images/lightbulb_off.png">Отключенные
</a>
</li>
</ul>
{ if $brands }
<h3 class="mb-2 mt-2">по маркам</h3>
<select id="brand_selector" name="brand">
<option value=""> -- Выберите марку --</option>
{ foreach $brands as $brand }
<option value=" { $brand - > id } " { if $brand - > id = = $brand_id } selected { /if } > { $brand - > name } </option>
{ /foreach }
</select>
{ /if }
{ if $tree }
<h3 class="mb-2 mt-4">по родителю</h3>
<select id="parent_selector" class="mw-100">
<option value=""> -- Выберите родителя --</option>
{ function name = services_tree level = 0 }
{ if $services }
{ foreach $services as $service }
<option { if $parent = = $service - > id } selected { /if }
value=" { $service - > id } "> { ' ' | str_repeat : ( $level * 2 ) } { $service - > name | escape } </option>
{ if $service - > children }
{ services_tree services = $service - > children level = $level + 1 }
{ /if }
{ /foreach }
{ /if }
{ /function }
{ services_tree services = $tree }
</select>
{ /if }
<div class="clearfix"></div>
<a class="text-danger text-center d-block mt-5" href="index.php?module=ServicesAdmin" title="Сбросить все фильтры">Сбросить
все фильтры</a>
</div>
{ literal }
<script>
$(document).ready(function () {
var $search_form = $('#search');
$('#brand_selector').on('change', function () {
$('[name="brand_id"]', $search_form).val(this.value);
$search_form.submit();
});
$('#parent_selector').on('change', function () {
$('[name="parent"]', $search_form).val(this.value);
$search_form.submit();
});
// Выделить все
$("#check_all").click(function () {
$('#list input[type="checkbox"][name*="check"]:not(:disabled)').attr('checked', $('#list input[type="checkbox"][name*="check"]:not(:disabled):not(:checked)').length > 0);
});
// Активировать
$("a.enable").click(function () {
var icon = $(this);
/*var line = icon.closest(".row");
var id = line.find('input[type="checkbox"][name*="check"]').val();*/
$('#list input[type="checkbox"][name*="check"]').attr('checked', false);
$(this).closest("div.row").find('input[type="checkbox"][name*="check"]:first').attr('checked', true);
$(this).closest("form").find('select[name="action"]').val(icon.hasClass('a-invisible') ? 'enable' : 'disable');
$(this).closest("form").submit();
/*icon.addClass('loading_icon');
$.ajax( {
type: 'POST',
url: 'ajax/update_object.php',
dataType: 'json',
data: {
'object': 'page',
'action': 'enable',
'id': id,
'values': { 'visible' : icon . hasClass ( 'a-invisible' ) ? 1 : 0 } ,
'session_id': ' { /literal } { $smarty.session.id } { literal } '
},
beforeSend: function () {
icon.addClass('loading_icon');
},
success: function (data) {
$('a.enable:first', line).toggleClass('a-invisible').toggleClass('a-visible');
icon.removeClass('loading_icon');
}
});*/
return false;
});
// Удалить
$("a.delete").click(function () {
$('#list input[type="checkbox"][name*="check"]').attr('checked', false);
$(this).closest("div.row").find('input[type="checkbox"][name*="check"]:first').attr('checked', true);
$(this).closest("form").find('select[name="action"] option[value=delete]').attr('selected', true);
$(this).closest("form").submit();
});
// Подтвердить удаление
$("#list_form").submit(function () {
if ($('select[name="action"]').val() == 'delete' && !confirm("Подтвердите удаление.\n\nВ нима ние !\nУ с лу г и будут удалены ТОЛЬКО если не имеют дочерних."))
return false;
});
});
</script>
{ /literal }