<?php
/**
 * FW Food menu 5.1.1
 * @copyright (C) 2020 Fastw3b
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.fastw3b.net/ Official website
 **/

defined( '_JEXEC' ) or die( 'Restricted access' );

JHTML::_('behavior.core');

JToolBarHelper::title(JText::_('FWFM_ADMIN_CSS_TOOLBAR_TITLE'), 'code');
fwfmButtonsHelper::apply('apply', 'FWFM_DOC_ADMIN_CSS_TOOLBAR_BTN_SAVE');

echo JLayoutHelper::render('common.menu_begin', array(
    'title' => JText::_('FWFM_DOC_ADMIN_CSS'),
    'title_hint' => JText::_('FWFM_DOC_ADMIN_CSS_HINT'),
	'view' => $this
), JPATH_COMPONENT);
?>
<div class="fwa-separate-box">
				<form id="adminForm" name="adminForm" class="css-styles" method="post" action="index.php?option=com_fwfoodmenu&view=css" enctype="multipart/form-data">
					<ul uk-tab>
						<li class="uk-active"><a href="#fwfm-custom-css"><?php echo JText::_('FWFM_DOC_ADMIN_CSS_TAB_CUSTOM') ?></a></li>
						<li><a href="#fwfm-foodmenu-css"><?php echo JText::_('FWFM_DOC_ADMIN_CSS_TAB_FWFM') ?></a></li>
<?php
if ($this->contents) {
	foreach ($this->contents as $row) {
?>
						<li><a href="#fwfm-foodmenu-<?php echo $row->element; ?>"><?php echo JText::_('FWFM_DOC_ADMIN_CSS_TAB_'.$row->element); ?></a></li>
<?php
	}
}
?>
					</ul>
					<div class="uk-switcher">
                        <div id="fwfm-custom-css">
							<div>
								<div>
									<div class="uk-card">
										<div class="uk-card-header">
											<div class="uk-card-subtitle"><?php echo JText::_('FWFM_DOC_ADMIN_CSS_TAB_CUSTOM_HINT'); ?></div>
										</div>
										<div class="uk-card-body">
											<?php echo $this->editor->display('additional_css', $this->object->params->get('additional_css'), 600, 400, 80, 7, false); ?>
										</div>
									</div>
								</div>
							</div>
						</div>
						<div id="fwfm-foodmenu-css">
							<div>
								<div>
									<div class="uk-card">
										<div class="uk-card-header">
											<div class="uk-card-subtitle pb-2"><?php echo JText::sprintf('FWFM_DOC_ADMIN_CSS_TAB_FWFM_HINT'); ?></div>
                                            <div class="uk-card-subtitle"><em><?php echo str_replace('\\', '/', $this->path); ?></em></div>
										</div>
										<div class="uk-card-body">
											<?php echo $this->editor->display('none', $this->content, '100%', 400, 80, 7, false); ?>
										</div>
									</div>
								</div>
							</div>
						</div>
<?php
if ($this->contents) {
	foreach ($this->contents as $row) {
?>
						<div id="fwfm-foodmenu-<?php echo $row->element; ?>">
							<div>
								<div>
									<div class="uk-card">
										<div class="uk-card-header">
											<div class="uk-card-subtitle pb-2">
												<span class="uk-align-right uk-badge uk-badge-default uk-margin-left"><i uk-icon="puzzle-piece" class="uk-margin-small-right"></i><?php echo JText::_('FWFM_DOC_ADMIN_CSS_TAB_'.$row->element.'_TITLE'); ?></span>
												<?php echo JText::_('FWFM_DOC_ADMIN_CSS_TAB_'.$row->element.'_HINT'); ?>
											</div>
                                            <div class="uk-card-subtitle"><em><?php echo str_replace('\\', '/', $row->path); ?></em></div>
										</div>
										<div class="uk-card-body">
											<?php echo $this->editor->display($row->element, $row->content, '100%', 400, 80, 7, false); ?>
										</div>
									</div>
								</div>
							</div>
						</div>
<?php
	}
}
?>
					</div>
					<input type="hidden" name="task" value="" />
					<input type="hidden" name="oid" value="1" />
				</form>
</div>				
<script>
document.addEventListener('DOMContentLoaded', function() {
	(function($) {
	$('ul[uk-tab] a').click(function() {
		$('.CodeMirror').each(function(i, el){
			setTimeout(function() {
				el.CodeMirror.refresh();
			}, 100);
		});
	});
	})(jQuery);
});
</script>
<?php
echo JLayoutHelper::render('utilites.quick_categories', array('view'=>$this), JPATH_COMPONENT);
echo JLayoutHelper::render('utilites.quick_meals', array('view'=>$this), JPATH_COMPONENT);
echo JLayoutHelper::render('common.menu_end', array(), JPATH_COMPONENT);
