{* Title *}
{$meta_title = "Менеджеры" scope=root}

{* Container *}
<div class="container-fluid">

    {* Title *}
    <div class="nk-block-head nk-block-head-sm">
    	<div class="nk-block-between">
    		<div class="nk-block-head-content">
                <h3 class="nk-block-title page-title">Список менеджеров</h3>
    			<div class="nk-block-des text-soft">
    				<p>Управление менеджерами магазина.</p>
    			</div>
    		</div>
    		<div class="nk-block-head-content">
    			<div class="toggle-wrap nk-block-tools-toggle">

    				{* Mobile toogle btn *}
    				<a href="#" class="btn btn-icon btn-trigger toggle-expand mr-n1" data-target="pageMenu">
    					<em class="icon ti ti-menu"></em>
    				</a>

    				{* Add btn *}
    				<div class="toggle-expand-content" data-content="pageMenu">
    					<ul class="nk-block-tools g-3">
    						<li>
    							<a href="{url module=ManagerAdmin}" class="btn btn-secondary">
    								<em class="icon ti ti-circle-plus"></em>
    								<span>Создать менеджера</span>
    							</a>
    						</li>
    					</ul>
    				</div>
    			</div>
    		</div>
    	</div>
    </div>

    {* Alerts *}
    {if $message_error}
    <div class="pb-2">
    	<div class="alert alert-fill alert-danger alert-icon">
    		<em class="icon ti ti-circle-x"></em>
    		{$message_error|escape}.
    	</div>
    </div>
    {/if}

    {* List *}
    <div class="nk-block js-list-footer-fixed">
    	<div class="card card-bordered card-stretch">
    		<div class="card-inner-group">

                {if $managers}
                <form class="js-list-form" method="post">
        			<div class="card-inner p-0">

        				{* Head *}
        				<div class="nk-tb-list nk-tb-ulist">
        					<div class="nk-tb-item nk-tb-head">

                                {* Check all *}
        						<div class="nk-tb-col nk-tb-col-check">
        							<div class="custom-control custom-control-sm custom-checkbox notext">
        								<input type="checkbox" class="custom-control-input js-check-all" id="checkall">
        								<label class="custom-control-label" for="checkall"></label>
        							</div>
        						</div>
                                <div class="nk-tb-col">
                                    <span class="sub-text">Менеджер</span>
                                </div>
        						<div class="nk-tb-col tb-col-md">
                                    <span class="sub-text">Права доступа</span>
                                </div>
        						<div class="nk-tb-col nk-tb-col-tools text-right"></div>
        					</div>
        				</div>

        				{* Main list *}
        				<div class="nk-tb-list nk-tb-ulist js-list">

                            {* Managers *}
        					{foreach from=$managers item=m key=key}
        					<div class="nk-tb-item js-list-item">

                                {* Checkbox *}
        						<div class="nk-tb-col nk-tb-col-check">
        							<div class="custom-control custom-control-sm custom-checkbox notext">
                                        <input type="checkbox" name="check[]" value="{$m->login|escape}" class="custom-control-input" id="uid_{$key}" {if $manager->login == $m->login}disabled{/if}>
                                        <label class="custom-control-label" for="uid_{$key}"></label>
                                    </div>
        						</div>

                                {* Name *}
        						<div class="nk-tb-col">
        							<a href="{url module=ManagerAdmin login=$m->login return=$smarty.server.REQUEST_URI}">
                                        <span class="tb-lead">
                                            {$m->login|escape}
                                        </span>
                                    </a>
        						</div>

                                {* Permissions *}
        						<div class="nk-tb-col tb-col-md">
                                    <div class="w-90">
                                        <p class="fs-13px">
                                            {foreach from=$m->permissions item=item key=key}{$key}{if !$item@last}, {/if}{/foreach}
                                        </p>
                                    </div>
        						</div>

                                {* Tools *}
        						<div class="nk-tb-col nk-tb-col-tools">
        							<ul class="nk-tb-actions gx-1">

                                        {* Delete *}
                                        <li>
                                            <button type="button" class="btn btn-trigger btn-icon text-danger js-list-delete" data-toggle="tooltip" data-placement="top" title="Удалить">
                                                <em class="icon ti ti-trash"></em>
                                            </button>
                                        </li>

        							</ul>
        						</div>
        					</div>
                            {/foreach}

        				</div>
        			</div>

                    {* Pagination *}
                    <div class="card-inner js-list-footer card-inner-footer-fixed">
                        <div class="nk-block-between-md g-3">
                            <div class="g">
                            	<div class="center form-inline flex-nowrap gx-3">
                                    <div class="form-wrap w-200px">
                                        <select name="action" class="form-select form-select-sm" data-placeholder="Массовые действия">
                                            <option value="">Массовые действия</option>
                                            <option value="delete">Удалить</option>
                                        </select>
                                    </div>
                                    <div class="btn-wrap">
                                        <span class="d-none d-md-block">
                                            <button type="submit" class="btn btn-dim btn-outline-light">Применить</button>
                                        </span>
                                        <span class="d-md-none">
                                            <button type="submit" class="btn btn-dim btn-outline-light btn-icon">
                                                <em class="icon ti ti-arrow-right"></em>
                                            </button>
                                        </span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
                {else}
                <div class="card-inner">
                    <div class="nk-tb-item">
                        <p>Менеджеры не найдены.</p>
                    </div>
                </div>
                {/if}
    		</div>
    	</div>
    </div>

</div>
