<?php
/* Smarty version 4.3.1, created on 2023-11-29 01:35:58
  from '/Users/nikolaimv/Sites/it-academy.loc/admin/templates/views/languages/language.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.3.1',
  'unifunc' => 'content_65664f2e0b30f5_25556242',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '8f2970c2ed04ac75af54572eb54ccaf2c49e5ce4' => 
    array (
      0 => '/Users/nikolaimv/Sites/it-academy.loc/admin/templates/views/languages/language.tpl',
      1 => 1679630384,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:components/page-header.tpl' => 1,
    'file:components/fields/select.tpl' => 1,
  ),
),false)) {
function content_65664f2e0b30f5_25556242 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_checkPlugins(array(0=>array('file'=>'/Users/nikolaimv/Sites/it-academy.loc/includes/composer/vendor/smarty/smarty/libs/plugins/function.html_options.php','function'=>'smarty_function_html_options',),1=>array('file'=>'/Users/nikolaimv/Sites/it-academy.loc/includes/composer/vendor/smarty/smarty/libs/plugins/modifier.date_format.php','function'=>'smarty_modifier_date_format',),));
?>
<form method="post" id="language">

	<!-- Page header -->
    <?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "buttons", null, null);?>
	    <button class="btn btn-sm btn-primary" type="submit" name="action" value="save"><i class="ph-floppy-disk me-2"></i> Сохранить</button>
        <?php if (!(isset($_smarty_tpl->tpl_vars['multiLang']->value['isDefault']))) {?>
		    <a class="btn btn-sm btn-light ms-2" href="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/langs">Отменить</a>
        <?php }?>
	    <!-- Page header -->
    <?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 $_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-8">
    
    		    <div class="card border shadow-sm">
			        <div class="card-header d-flex flex-wrap">
				        <h6 class="mb-0">Основное</h6>
				        <div class="d-inline-flex ms-auto">
					        <a class="text-body" data-card-action="collapse"><i class="ph-caret-down"></i></a>
				        </div>
			        </div>
			        <div class="collapse show">
	                    <div class="card-body">
	                        <div class="row">
	                            <?php if (!(isset($_smarty_tpl->tpl_vars['language']->value['languageId']))) {?>
					                <div class="col-md-12">
							            <div class="form-group mb-3">
								            <label class="form-label is-visible">Предустановленные языки</label>
	                                        <?php echo smarty_function_html_options(array('options'=>$_smarty_tpl->tpl_vars['languageOptions']->value,'selected'=>(($tmp = $_smarty_tpl->tpl_vars['language']->value['codename'] ?? null)===null||$tmp==='' ? '' ?? null : $tmp),'name'=>'languageOptions','onChange'=>"languageOptionChange(this)",'class'=>"form-control select"),$_smarty_tpl);?>

							            </div>
					                </div>
	                            <?php }?>
	                            <div class="<?php if (!(isset($_smarty_tpl->tpl_vars['language']->value['languageId']))) {?> col-md-6<?php } else { ?>col-md-12<?php }?>">
	                                <div class="form-group mb-3">
	                                    <label class="form-label is-visible <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['languageName']))) {?>text-danger<?php }?>">Язык</label>
	                                    <input type="text" class="form-control" autocomplete="off" id="languageName" name="language[languageName]" value="<?php if ((isset($_smarty_tpl->tpl_vars['language']->value['languageName']))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['languageName'], ENT_QUOTES, 'UTF-8', true);
}?>" placeholder="латинскими буквами, например: Russian, English, German, French">
	                                </div>

	                                <?php if (!(isset($_smarty_tpl->tpl_vars['language']->value['languageId']))) {?>
	                                <div class="form-group mb-3">
	                                    <label class="form-label is-visible <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['codename'])) || (isset($_smarty_tpl->tpl_vars['errors']->value['codenameExists'])) || (isset($_smarty_tpl->tpl_vars['errors']->value['codenameCharacters']))) {?>text-danger<?php }?>">Код языка</label>
	                                    <input class="form-control" autocomplete="off" id="codename" type="text" name="language[codename]" value="<?php if ((isset($_smarty_tpl->tpl_vars['language']->value['codename']))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['language']->value['codename'], ENT_QUOTES, 'UTF-8', true);
}?>" placeholder="2 латинские буквы, например: ru, en, de, fr"/>
	                                </div>
	                                <?php }?>
	                            </div>

	                            <div class="col-md-6">
	                                <?php if (!(isset($_smarty_tpl->tpl_vars['action']->value['toMultilangMode']))) {?>
	                                    <?php if (!(isset($_smarty_tpl->tpl_vars['language']->value['languageId']))) {?>
	                                    <div class="form-group mb-3">
	                                        <label class="form-label is-visible">Используемый язык</label>
	                                        <?php echo '<script'; ?>
 type="text/javascript">
	                                            lang2charset = {	<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['languageCharsets']->value, 'charset', false, 'lang', 'languageCharsets', array (
  'last' => true,
  'iteration' => true,
  'total' => true,
));
$_smarty_tpl->tpl_vars['charset']->do_else = true;
if ($_from !== null) foreach ($_from as $_smarty_tpl->tpl_vars['lang']->value => $_smarty_tpl->tpl_vars['charset']->value) {
$_smarty_tpl->tpl_vars['charset']->do_else = false;
$_smarty_tpl->tpl_vars['__smarty_foreach_languageCharsets']->value['iteration']++;
$_smarty_tpl->tpl_vars['__smarty_foreach_languageCharsets']->value['last'] = $_smarty_tpl->tpl_vars['__smarty_foreach_languageCharsets']->value['iteration'] === $_smarty_tpl->tpl_vars['__smarty_foreach_languageCharsets']->value['total'];
?>"<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['lang']->value, ENT_QUOTES, 'UTF-8', true);?>
":"<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['charset']->value, ENT_QUOTES, 'UTF-8', true);?>
"
	                                            <?php if (!(isset($_smarty_tpl->tpl_vars['__smarty_foreach_languageCharsets']->value['last']) ? $_smarty_tpl->tpl_vars['__smarty_foreach_languageCharsets']->value['last'] : null)) {?>,<?php }
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl, 1);?> };
	                                        <?php echo '</script'; ?>
>
	                                        <?php echo smarty_function_html_options(array('options'=>$_smarty_tpl->tpl_vars['adminLangs']->value,'name'=>"language[admin_language]",'id'=>"adminLanguageOptions",'class'=>"form-control select"),$_smarty_tpl);?>

	                                    </div>
	                                    <div class="form-group mb-3">
	                                        <label class="form-label is-visible">Кодировка сайта</label>
	                                        <?php echo smarty_function_html_options(array('options'=>$_smarty_tpl->tpl_vars['charsetOptions']->value,'name'=>"language[charset]",'id'=>"charsetOptions",'class'=>"form-control select"),$_smarty_tpl);?>

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

            <div class="col-md-4">
        		<div class="card border shadow-sm">
			        <div class="card-header d-flex flex-wrap">
				        <h6 class="mb-0">Статус и видимость</h6>
				        <div class="d-inline-flex ms-auto">
					        <a class="text-body" data-card-action="collapse"><i class="ph-caret-down"></i></a>
				        </div>
			        </div>
			        <div class="collapse show">
	                    <div class="card-body">
                                                        <?php $_smarty_tpl->_subTemplateRender("file:components/fields/select.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array('id'=>"status",'title'=>"Статус",'field'=>"language[status]",'array'=>$_smarty_tpl->tpl_vars['statuses']->value,'selected'=>(($tmp = $_smarty_tpl->tpl_vars['language']->value['status'] ?? null)===null||$tmp==='' ? 'V' ?? null : $tmp),'class'=>"form-group mb-3"), 0, false);
?>
                            	                    </div>
                        <?php if ((isset($_smarty_tpl->tpl_vars['language']->value['addedOn'])) && (isset($_smarty_tpl->tpl_vars['language']->value['modifiedOn']))) {?>
				        <div class="card-footer hstack gap-3 justify-content-between">
					        <div class="text-muted">
						        <ul class="list list-unstyled mb-0 fs-sm">
	                                <li>Создано</li>
	                                <li>Изменено</li>
						        </ul>
					        </div>
					        <div class="hstack gap-1">
						        <ul class="list list-unstyled mb-0 fs-sm">
	                                <li><?php echo htmlspecialchars((string)smarty_modifier_date_format($_smarty_tpl->tpl_vars['language']->value['addedOn'],"%d.%m.%Y %H:%M"), ENT_QUOTES, 'UTF-8', true);?>
 (<?php echo htmlspecialchars((string)(($tmp = $_smarty_tpl->tpl_vars['language']->value['addedBy']['loginName'] ?? null)===null||$tmp==='' ? "Неизвестный пользователь" ?? null : $tmp), ENT_QUOTES, 'UTF-8', true);?>
)</li>
	                                <li><?php echo htmlspecialchars((string)smarty_modifier_date_format($_smarty_tpl->tpl_vars['language']->value['modifiedOn'],"%d.%m.%Y %H:%M"), ENT_QUOTES, 'UTF-8', true);?>
 (<?php echo htmlspecialchars((string)(($tmp = $_smarty_tpl->tpl_vars['language']->value['modifiedBy']['loginName'] ?? null)===null||$tmp==='' ? "Неизвестный пользователь" ?? null : $tmp), ENT_QUOTES, 'UTF-8', true);?>
)</li>
						        </ul>
					        </div>
				        </div>
				        <?php }?>
			        </div>
    			</div>
            </div>

	        <div class="col-md-12 text-center">
                <?php if ((isset($_smarty_tpl->tpl_vars['language']->value['languageId']))) {?><input type="hidden" class="form-control" id="id" name="id" value="<?php echo htmlspecialchars((string)(($tmp = $_smarty_tpl->tpl_vars['language']->value['languageId'] ?? null)===null||$tmp==='' ? '' ?? null : $tmp), ENT_QUOTES, 'UTF-8', true);?>
"><?php }?>
                <?php echo $_smarty_tpl->smarty->ext->_capture->getBuffer($_smarty_tpl, 'buttons');?>

	        </div>

        </div>
    </div>

</form>

<?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['language']->value['languageName'], ENT_QUOTES, 'UTF-8', true);?>
» язык не сохранен.', type: 'error', timeout: 1500 }).show(); <?php }?>
    <?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['languageName']))) {?> new Noty({ text: 'Введите название языка.', type: 'error', timeout: 1500 }).show(); <?php }?>
    <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['codename']))) {?> new Noty({ text: 'Введите кодовое обозначение языка.', type: 'error', timeout: 1500 }).show(); <?php }?>
    <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['codenameExists']))) {?> new Noty({ text: 'Язык с таким кодовым обозначением уже существует.', type: 'error', timeout: 1500 }).show(); <?php }?>
    <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['codenameCharacters']))) {?> new Noty({ text: 'Кодовое обозначение языка может содержать только строчные латинские буквы от a до z.', type: 'error', timeout: 1500 }).show();<?php }?>
    <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['languageNameCharacters']))) {?> new Noty({ text: 'Название языка может содержать только латинские буквы от A до z.', type: 'error', timeout: 1500 }).show();<?php }?>

    <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['htaccess']))) {?> new Noty({ text: 'Невозможно сохранить файл ".htaccess".', 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 }?>
});
function moveUpMessage(){ new Noty({ text: 'Раздел перемещен вверх.', type: 'warning', timeout: 1500 }).show(); }
function moveDownMessage(){ new Noty({ text: 'Раздел перемещен вниз.', type: 'warning', timeout: 1500 }).show(); }
  
document.getElementById('language').languageName.focus();

<?php if ((isset($_smarty_tpl->tpl_vars['action']->value['toMultilangMode']))) {?>

    var website_language = '<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['config']->value['website_language'], ENT_QUOTES, 'UTF-8', true);?>
';
    
    var languageOptions = document.getElementById('languageOptions').options;
    for (i = 0; i < languageOptions.length; i++) {
    	if (languageOptions[i].value == website_language) {
    		languageOptions[i].selected = true;
    		languageOptionChange(languageOptions);
    		break;
    	}
    }

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