<?php
/* Smarty version 4.5.2, created on 2024-08-15 07:49:29
  from '/home/life/public_html/teg.lifestyle.uz/admin/templates/views/templates/templates.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.2',
  'unifunc' => 'content_66bdb309930336_45038412',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '143f8dfa5b9020d12d793991b8f1024ae62615b8' => 
    array (
      0 => '/home/life/public_html/teg.lifestyle.uz/admin/templates/views/templates/templates.tpl',
      1 => 1679779223,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:components/page-header.tpl' => 1,
  ),
),false)) {
function content_66bdb309930336_45038412 (Smarty_Internal_Template $_smarty_tpl) {
echo '<script'; ?>
 type="text/javascript" src="/admin/assets/js/fileTree.min.js"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
 type="text/javascript" src="/admin/assets/js/codemirror/codemirror.js"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/codemirror/mode/htmlmixed/htmlmixed.js"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/codemirror/mode/xml/xml.js"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/codemirror/mode/javascript/javascript.js"><?php echo '</script'; ?>
>
<?php echo '<script'; ?>
 type='text/javascript' src="/admin/assets/js/codemirror/mode/css/css.js"><?php echo '</script'; ?>
>

<div class="modal animated fadeIn" id="new_file" tabindex="-1" role="dialog" aria-labelledby="smallModalHead" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header"><h4 class="modal-title" id="smallModalHead">Новый шаблон</h4></div>
			<form action="<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['adminUrl']->value, ENT_QUOTES, 'UTF-8', true);?>
/templates" method="post" id="template" class="newTemplate">
				<input type="hidden" name="template[isNew]" value="1" />
				<div class="col-md-12  push-down-20 push-up-20">
					<div class="form-group">
						<input class="form-control" autocomplete="off" id="fileName" type="text" name="template[fileName]" value="<?php if ((isset($_smarty_tpl->tpl_vars['template']->value['fileName']))) {
echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['template']->value['fileName'], ENT_QUOTES, 'UTF-8', true);
}?>" placeholder="Введите название шаблона без расширения"/>
					</div>
				</div>
				<div class="modal-footer">
					<button type="submit" class="btn btn-primary" name="action" value="save">Сохранить</button> &nbsp;
					<button type="button" class="btn btn-primary" data-dismiss="modal">Отменить</button>
				</div>
			</form>
		</div>
	</div>
</div>

<!-- Page header -->
<?php $_smarty_tpl->smarty->ext->_capture->open($_smarty_tpl, "buttons", null, null);?>
    <?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);?>
/templates" 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);
$_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 -->

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

			<div class="card border shadow-sm">
				<div class="row">
					<div class="col-md-2 p-0">
						<div id="filetree" class="filetree"></div>
					</div>
					<div class="col-md-10 pl-0">
						<div id="fileedit" style="border-left: solid 1px #BBB;min-height: 565px; padding:0px;"></div>
					</div>
				</div>

			</div>

		</div>

	</div>
</div>

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

    $(document).ready(function () {
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['not_found']))) {?> new Noty({ text: 'Шаблон не найден или доступ запрещен.', type: 'error', timeout: 1500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['not_saved']))) {?> new Noty({ text: 'Шаблон НЕ сохранен.', type: 'error', timeout: 1500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileName']))) {?> new Noty({ text: 'Введите имя файла шаблона.', type: 'error', timeout: 1500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileNameExists']))) {?> new Noty({ text: 'Шаблон с таким именем файла уже существует. Введите другое имя.', type: 'error', timeout: 1500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['errors']->value['fileNameCharacters']))) {?> new Noty({ text: 'Имя фала может содержать только следующие символы: A-Z a-z 0-9 . , - _ ( ).', 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['template_changed']))) {?> new Noty({ text: 'Тема изменена...', type: 'success', timeout: 1500 }).show(); <?php }?>
        <?php if ((isset($_smarty_tpl->tpl_vars['messages']->value['saved_new_file']))) {?> new Noty({ text: 'Новый шаблон создан!', type: 'success', timeout: 1500  }).show(); <?php }?>
    });

    $(function($){
        $('#filetree').fileTree({
                root: '/',
                script: '/admin/handlers/assets-files-tree.php?root=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['config']->value['theme'], ENT_QUOTES, 'UTF-8', true);?>
',
                folderEvent: 'click',
                expanded: '/',
                expandSpeed: 300,
                collapseSpeed: 250,
                multiFolder: false,
            },
            function(path) {
                $.post('/admin/handlers/assets-files-tree.php?root=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['config']->value['theme'], ENT_QUOTES, 'UTF-8', true);?>
&action=load', { "file[path]": path }, function(response) {
                    // console.log(data);
                    $('#fileedit').html(response);
                }, 'html');
            }
        );
    });

    function updateFile(path) {
        var content = editor.getValue();
        $.post('/admin/handlers/assets-files-tree.php?root=<?php echo htmlspecialchars((string)$_smarty_tpl->tpl_vars['config']->value['theme'], ENT_QUOTES, 'UTF-8', true);?>
&action=save', { "file[path]": path, "file[content]": content }, function(response) {
            new Noty({ text: response.message, type: response.type }).show();
        });
    }

    $(".newTemplate").submit(function() {
        var form_data = $(this).serialize();
        $.ajax({
            type: $(".newTemplate").attr("method"),
            url: $(".newTemplate").attr("action"),
            data: form_data,
            success: function() {

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





<?php }
}
