<?php
/* Smarty version 4.5.2, created on 2024-04-14 18:17:18
  from '/Users/nikolaimv/Sites/admin.panel.11.loc/admin/templates/views/languages/languages.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.2',
  'unifunc' => 'content_661bd75e05da26_77860856',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'b8aadd7c46f03c4739fee7c0292921ac0c697d7d' => 
    array (
      0 => '/Users/nikolaimv/Sites/admin.panel.11.loc/admin/templates/views/languages/languages.tpl',
      1 => 1700383157,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:components/page-header.tpl' => 1,
  ),
),false)) {
function content_661bd75e05da26_77860856 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/Users/nikolaimv/Sites/admin.panel.11.loc/includes/composer/vendor/smarty/smarty/libs/plugins/modifier.count.php','function'=>'smarty_modifier_count',),1=>array('file'=>'/Users/nikolaimv/Sites/admin.panel.11.loc/includes/composer/vendor/smarty/smarty/libs/plugins/function.html_options.php','function'=>'smarty_function_html_options',),));
?>

	<!-- 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);?>
/lang?action=add"><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);?>
/langs" 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 if (smarty_modifier_count($_smarty_tpl->tpl_vars['LANGUAGES']->value) > 1 && empty($_smarty_tpl->tpl_vars['SITE_LANG']->value)) {?>
			<button class="btn btn-sm btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#changeLangRow">
				<i class="ph-arrows-out-line-vertical me-2"></i> Изменить основной язык
			</button>
	    <?php }?>
	<?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 -->

	<?php if ((isset($_smarty_tpl->tpl_vars['action']->value)) && $_smarty_tpl->tpl_vars['action']->value == 'confirmDelete') {?>
	    		<div class="content">
		    <div class="row">
		        <div class="col-md-12">
		            <div class="card border shadow-sm">
		                <div class="card-body">
		                     <form action="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/langs" method="post" id="language">
			                     <div class="alert bg-danger text-white alert-dismissible mb-3">
				                     <span class="font-weight-semibold">Удалить языковую версию сайта<br><?php if (!$_smarty_tpl->tpl_vars['language']->value['isDefault']) {?> При удалении языковой версии сайта так же будут удалены все картинки, файлы и таблицы с данными для этого языка. <?php }?></span>
			                     </div>
			                     <div class="form-check mb-2">
				                     <input type="checkbox" class="form-check-input" id="confirmDelete" onclick="document.getElementById('submitBtn').disabled = !this.checked;">
				                     <label class="form-check-label" for="confirmDelete">Подтвердите ваше намерение удалить языковую версию сайта: <b><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageName'], ENT_QUOTES, 'UTF-8', true);?>
</b></label>
			                     </div>

		                        <div class="text-center mt-3">
		                            <input type="hidden" name="id" value="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageId'], ENT_QUOTES, 'UTF-8', true);?>
" />
		                            <input type="hidden" name="action" value="remove" />
		                            <button class="btn btn-sm btn-primary me-2" type="button" id="submitBtn" disabled="disabled" onclick="this.form.submit()" ><i class="ph-trash me-2"></i>Удалить</button>
		                            <a class="btn btn-sm btn-light" type="button" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/langs">Отменить</a>
		                        </div>
		                    </form>
		                </div>
		            </div>

		        </div>
		    </div>
		</div>
	    
	<?php } else { ?>

		<div class="content">
		    <div class="row">
		        <div class="col-md-12">
				    		            <div id="changeLangRow" class="collapse">
				        <div class="card border shadow-sm bg-light p-2 d-sm-flex align-items-sm-center">
					        <div class="mb-0"></div>
					        <div class="ms-sm-auto">
						        <ul class="list-inline list-inline-condensed mb-0">
							        <li class="list-inline-item text-muted"><i class="ph-arrows-out-line-vertical"></i> Изменить основной язык</li>
							        <li class="list-inline-item">
								        <form action="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/langs" method="post" id="searchForm" onclick="confirmLanguageChange(this)">
									        <div class="input-group">
										        <?php echo smarty_function_html_options(array('options'=>$_smarty_tpl->tpl_vars['defaultLanguageOptions']->value,'id'=>'defaultLang','name'=>"id",'class'=>"form-control select",'data-width'=>"300"),$_smarty_tpl);?>

										        <button class="btn btn-sm btn-primary" type="submit" name="action" value="changeDefaultLanguage">Сделать основным</button>
									        </div>
								        </form>
							        </li>
						        </ul>
					        </div>
				        </div>
		            </div>
		            
		            <div class="card border shadow-sm">
			            <div class="">
			                <table class="table table-togglable table-striped table-hover" id="languages">
			                    <thead>
			                        <tr>
			                            <th data-hide="phone" class="text-center" width="30">#</th>
			                            <th data-hide="phone" class="text-center" nowrap="nowrap">Код языка</th>
			                            <th data-hide="phone" >ФЛАГ</th>
			                            <th data-toggle="true">Язык</th>
			                            <th class="text-center text-muted" width="50"><i class="ph-check"></i></th>
			                        </tr>
			                    </thead>
			                    <?php if ((isset($_smarty_tpl->tpl_vars['languages']->value))) {?>
			                    <tbody class="sortable">
			                        <?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['languages']->value, 'language', false, NULL, 'languages', array (
));
$_smarty_tpl->tpl_vars['language']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['language']->value) {
$_smarty_tpl->tpl_vars['language']->do_else = false;
?>
			                        <tr id="language-<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageId'], ENT_QUOTES, 'UTF-8', true);?>
" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageId'], ENT_QUOTES, 'UTF-8', true);?>
" class="<?php if ($_smarty_tpl->tpl_vars['language']->value['status'] == 'H') {?>table-warning<?php }?>">
				                        <td class="text-center text-nowrap"><i class="ph-dots-six text-muted"></i></td>
			                            <td class="text-center text-nowrap"><a href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['url'], ENT_QUOTES, 'UTF-8', true);?>
" target="_blank"><?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['codename'], ENT_QUOTES, 'UTF-8', true);?>
</a></td>
			                            <td class="text-center text-nowrap"><img src="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['GLOBAL_URL']->value, ENT_QUOTES, 'UTF-8', true);?>
/admin/assets/lang/<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['codename'], ENT_QUOTES, 'UTF-8', true);?>
.svg" style="width: 30px;"></td>
			                            <td width="100%"><?php echo htmlspecialchars((string)(($tmp = $_smarty_tpl->tpl_vars['language']->value['languageTransName'] ?? null)===null||$tmp==='' ? $_smarty_tpl->tpl_vars['navLang']->value->languageName ?? null : $tmp), ENT_QUOTES, 'UTF-8', true);
if ($_smarty_tpl->tpl_vars['language']->value['isDefault']) {?> (<b>По умолчанию</b>)<?php }?></td>

			                            <td class="text-end">
			                                <div class="d-inline-flex">
				                                <div class="text-body">
	                                                <?php if (!$_smarty_tpl->tpl_vars['language']->value['isDefault']) {?>
						                                <div class="form-check form-switch mb-2">
							                                <input type="checkbox" class="form-check-input ajax_action" data-module="langs" data-action="status" data-id="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageId'], ENT_QUOTES, 'UTF-8', true);?>
" <?php if ($_smarty_tpl->tpl_vars['language']->value['status'] == 'V') {?>checked<?php }?>>
						                                </div>
	                                                <?php }?>
				                                </div>
			                                    <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-right">
			                                            <a class="dropdown-item" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/lang?action=edit&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageId'], ENT_QUOTES, 'UTF-8', true);?>
"><i class="ph-note-pencil me-2"></i> Редактировать</a>
			                                            <?php if (!$_smarty_tpl->tpl_vars['language']->value['isDefault']) {?>
			                                                <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);?>
/langs?action=confirmDelete&id=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageId'], 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>
		            </div>
		        </div>
		    </div>
		</div>
	<?php }?>

	 <?php echo '<script'; ?>
>
	    $(document).ready(function () {
	        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['language_not_found']))) {?> new Noty({ text: 'Язык не найден.', type: 'error', timeout: 1500 }).show(); <?php }?>
	        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['serializations']))) {?> new Noty({ text: 'Невозможно сохранить сериализационный файл.', type: 'error', timeout: 1500 }).show(); <?php }?>

	        <?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['messages']->value['deleted']))) {?> new Noty({ text: 'Язык удален.', type: 'success', timeout: 1500 }).show(); <?php }?>
	    });

        $(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);?>
/langs?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 }
}
