This commit is contained in:
2024-01-28 10:53:31 +07:00
parent 7217f8b92f
commit 9052a3b7dd
10 changed files with 73 additions and 73 deletions

View File

@@ -9,7 +9,7 @@ function _get_menu_list() {
'product', 'product',
'customer', 'customer',
'marketing', 'marketing',
'investor_relation', //'investor_relation',
'article', 'article',
'job', 'job',
'pcbuilder', 'pcbuilder',
@@ -21,8 +21,21 @@ function _get_menu_list() {
$menu_list = []; $menu_list = [];
foreach ($main_items as $item) { foreach ($main_items as $item) {
$menu_list[$item] = include_once __DIR__."/menu_item/".$item.".php"; $item_menu = include_once __DIR__."/menu_item/".$item.".php";
// skip not enabled
if(!$item_menu['enable']) continue;
// skip not enabled children
$item_menu_children_enabled = array_filter($item_menu['menu'], function ($menu_child) { return $menu_child['enable'];});
if(!sizeof($item_menu_children_enabled)) continue;
// reset menu for $item_menu
$item_menu['menu'] = $item_menu_children_enabled;
$menu_list[$item] = $item_menu;
} }
return $menu_list; return $menu_list;
} }

View File

@@ -5,7 +5,6 @@ return array(
"name" => "Tuyển dụng", "name" => "Tuyển dụng",
"url" => "", "url" => "",
"menu" => array( "menu" => array(
array( array(
'enable' => true , 'enable' => true ,
'module' => 'job', 'module' => 'job',

View File

@@ -2,7 +2,6 @@
return array( return array(
'enable' => true , 'enable' => true ,
"name" => "Marketing", "name" => "Marketing",
"url" => "", "url" => "",
"menu" => array( "menu" => array(
@@ -51,23 +50,23 @@ return array(
'url' => '/admin/?opt=marketing&view=poster-upload', 'url' => '/admin/?opt=marketing&view=poster-upload',
), ),
array( /* array(
'enable' => true , 'enable' => true ,
'module' => 'system', 'module' => 'system',
'view' => 'store-design', 'view' => 'store-design',
'id' => 'system/store-design', 'id' => 'system/store-design',
'name' => 'Hình nền website', 'name' => 'Hình nền website',
'url' => '/admin/?opt=system&view=store-design&section=background', 'url' => '/admin/?opt=system&view=store-design&section=background',
), ),*/
array( /* array(
'enable' => false, 'enable' => false,
'module' => 'email', 'module' => 'email',
'view' => 'home', 'view' => 'home',
'id' => 'email/home', 'id' => 'email/home',
'name' => 'Email', 'name' => 'Email',
'url' => '/admin/?opt=email', 'url' => '/admin/?opt=email',
), ),*/
array( array(
'enable' => false, 'enable' => false,

View File

@@ -2,11 +2,10 @@
return array( return array(
'enable' => true , 'enable' => true ,
"name" => "Trả góp", "name" => "Trả góp",
"url" => "", "url" => "",
"menu" => array( "menu" => array(
0 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'payinstall', 'module' => 'payinstall',
'view' => 'order', 'view' => 'order',
@@ -15,7 +14,7 @@ return array(
'url' => '/admin/?opt=payinstall&view=order', 'url' => '/admin/?opt=payinstall&view=order',
), ),
1 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'payinstall', 'module' => 'payinstall',
'view' => 'home', 'view' => 'home',
@@ -24,7 +23,7 @@ return array(
'url' => '/admin/?opt=payinstall', 'url' => '/admin/?opt=payinstall',
), ),
2 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'payinstall', 'module' => 'payinstall',
'view' => 'category', 'view' => 'category',

View File

@@ -4,7 +4,6 @@
return array( return array(
'enable' => true , 'enable' => true ,
"name" => "Sản phẩm", "name" => "Sản phẩm",
"url" => "", "url" => "",
"menu" => array( "menu" => array(
@@ -17,32 +16,32 @@ return array(
'url' => '/admin/?opt=product', 'url' => '/admin/?opt=product',
), ),
array( /* array(
'enable' => false , 'enable' => false ,
'module' => 'product', 'module' => 'product',
'view' => 'user-rating', 'view' => 'user-rating',
'id' => 'product/user-rating', 'id' => 'product/user-rating',
'name' => 'Đánh giá ', 'name' => 'Đánh giá ',
'url' => '/admin/?opt=product&view=user-rating', 'url' => '/admin/?opt=product&view=user-rating',
), ),*/
array( /*array(
'enable' => false , 'enable' => false ,
'module' => 'product', 'module' => 'product',
'view' => 'product-customer-image', 'view' => 'product-customer-image',
'id' => 'product/product-customer-image', 'id' => 'product/product-customer-image',
'name' => 'Ảnh người dùng gửi', 'name' => 'Ảnh người dùng gửi',
'url' => '/admin/?opt=product&view=product-customer-image', 'url' => '/admin/?opt=product&view=product-customer-image',
), ),*/
array( /*array(
'enable' => true , 'enable' => true ,
'module' => 'product', 'module' => 'product',
'view' => 'product-list-update', 'view' => 'product-list-update',
'id' => 'product/product-list-update', 'id' => 'product/product-list-update',
'name' => 'Bảng giá cập nhật', 'name' => 'Bảng giá cập nhật',
'url' => '/admin/?opt=product&view=product-list-update', 'url' => '/admin/?opt=product&view=product-list-update',
), ),*/
array( array(
'enable' => true , 'enable' => true ,
@@ -87,7 +86,7 @@ return array(
), ),
array( array(
'enable' => false , 'enable' => true ,
'module' => 'addon', 'module' => 'addon',
'view' => 'home', 'view' => 'home',
'id' => 'addon/home', 'id' => 'addon/home',
@@ -96,7 +95,7 @@ return array(
), ),
array( array(
'enable' => false , 'enable' => true ,
'module' => 'config_group', 'module' => 'config_group',
'view' => 'home', 'view' => 'home',
'id' => 'config_group/home', 'id' => 'config_group/home',
@@ -104,53 +103,35 @@ return array(
'url' => '/admin/?opt=config_group', 'url' => '/admin/?opt=config_group',
), ),
array( /*array(
'enable' => false , 'enable' => false ,
'module' => 'supplier', 'module' => 'supplier',
'view' => 'home', 'view' => 'home',
'id' => 'supplier/home', 'id' => 'supplier/home',
'name' => 'Nhà cung cấp', 'name' => 'Nhà cung cấp',
'url' => '/admin/?opt=supplier', 'url' => '/admin/?opt=supplier',
), ),*/
array( /* array(
'enable' => false ,
'module' => 'product',
'view' => 'product-erp-not-web',
'id' => 'product/product-erp-not-web',
'name' => 'SP ERP chưa có trên web',
'url' => '/admin/?opt=product&view=product-erp-not-web',
),
array(
'enable' => false , 'enable' => false ,
'module' => 'product', 'module' => 'product',
'view' => 'set-promotion-price', 'view' => 'set-promotion-price',
'id' => 'product/set-promotion-price', 'id' => 'product/set-promotion-price',
'name' => 'Cài đặt giá khuyến mại', 'name' => 'Cài đặt giá khuyến mại',
'url' => '/admin/?opt=product&view=set-promotion-price', 'url' => '/admin/?opt=product&view=set-promotion-price',
), ),*/
array( /*array(
'enable' => false , 'enable' => false ,
'module' => 'product', 'module' => 'product',
'view' => 'product-per-customer-group', 'view' => 'product-per-customer-group',
'id' => 'product/product-per-customer-group', 'id' => 'product/product-per-customer-group',
'name' => 'Giá theo nhóm khách hàng', 'name' => 'Giá theo nhóm khách hàng',
'url' => '/admin/?opt=product&view=product-per-customer-group', 'url' => '/admin/?opt=product&view=product-per-customer-group',
), ),*/
array( array(
'enable' => false , 'enable' => true ,
'module' => 'product',
'view' => 'list-competitor',
'id' => 'product/list-competitor',
'name' => 'So sánh giá đối thủ',
'url' => '/admin/?opt=product&view=list-competitor',
),
array(
'enable' => false ,
'module' => 'product', 'module' => 'product',
'view' => 'set', 'view' => 'set',
'id' => 'product/set', 'id' => 'product/set',
@@ -166,6 +147,5 @@ return array(
'name' => 'Nhóm thông số kỹ thuật', 'name' => 'Nhóm thông số kỹ thuật',
'url' => '/admin/?opt=product&view=spec-group', 'url' => '/admin/?opt=product&view=spec-group',
), ),
), ),
); );

View File

@@ -6,7 +6,7 @@ return array(
"name" => "Thống kê", "name" => "Thống kê",
"url" => "", "url" => "",
"menu" => array( "menu" => array(
0 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'visitor', 'view' => 'visitor',
@@ -15,7 +15,7 @@ return array(
'url' => '/admin/?opt=report&view=visitor', 'url' => '/admin/?opt=report&view=visitor',
), ),
1 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'customer', 'view' => 'customer',
@@ -24,7 +24,7 @@ return array(
'url' => '/admin/?opt=report&view=customer', 'url' => '/admin/?opt=report&view=customer',
), ),
2 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'order', 'view' => 'order',
@@ -33,7 +33,7 @@ return array(
'url' => '/admin/?opt=report&view=order', 'url' => '/admin/?opt=report&view=order',
), ),
3 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'product-buy', 'view' => 'product-buy',
@@ -42,7 +42,7 @@ return array(
'url' => '/admin/?opt=report&view=product-buy', 'url' => '/admin/?opt=report&view=product-buy',
), ),
4 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'product-visit', 'view' => 'product-visit',
@@ -51,7 +51,7 @@ return array(
'url' => '/admin/?opt=report&view=product-visit', 'url' => '/admin/?opt=report&view=product-visit',
), ),
5 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'referer', 'view' => 'referer',
@@ -60,7 +60,7 @@ return array(
'url' => '/admin/?opt=report&view=referer', 'url' => '/admin/?opt=report&view=referer',
), ),
6 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'search', 'view' => 'search',
@@ -69,13 +69,13 @@ return array(
'url' => '/admin/?opt=report&view=search', 'url' => '/admin/?opt=report&view=search',
), ),
/*7 => array( array(
'enable' => true , 'enable' => true ,
'module' => 'report', 'module' => 'report',
'view' => 'error-page', 'view' => 'error-page',
'id' => '', 'id' => '',
'name' => 'Lỗi website', 'name' => 'Lỗi website',
'url' => '/admin/?opt=report&view=error-page', 'url' => '/admin/?opt=report&view=error-page',
),*/ ),
), ),
); );

View File

@@ -55,8 +55,8 @@ class AppAdmin
$data = include_once $module_file; $data = include_once $module_file;
$global_data = [ $global_data = [
"name" => $this->current_route_info['module'], "module" => $this->current_route_info['module'],
"view" => $this->current_route_info['view'], "view" => $this->current_route_info['view'],
"main_menu" => include_once ROOT_DIR."/data/menu.php", "main_menu" => include_once ROOT_DIR."/data/menu.php",
]; ];

View File

@@ -1,5 +1,14 @@
<?php <?php
function debug_var($input) {
@ob_start();
print_r($input);
$content = ob_get_contents();
@ob_end_clean();
echo join("\r", ['<textarea cols="80" rows="20">', $content, '</textarea>']) ;
}
function init_autoload(){ function init_autoload(){
$classLoader = require_once ROOT_DIR . '/package/vendor/autoload.php'; $classLoader = require_once ROOT_DIR . '/package/vendor/autoload.php';
$classLoader->add("Hura8", ROOT_DIR . '/inc' ); $classLoader->add("Hura8", ROOT_DIR . '/inc' );

View File

@@ -1,9 +1,10 @@
{% include javascript/global %} {% include javascript/global %}
{% if global.name == 'home' %} {% if global.module == 'home' %}
{% include javascript/homepage %} {% include javascript/homepage %}
{% elsif global.module == 'product' %}
{% include javascript/product_form %}
{% endif %} {% endif %}
{% if global.name == 'product' %}
{% include javascript/product_form %}
{% endif %}

View File

@@ -24,12 +24,12 @@
</head> </head>
<body> <body>
{{ global | show_var }} <!--
{{ page | show_var }} {{ page | show_var }}-->
<div class="admin-global-container"> <div class="admin-global-container">
<!-- Menu --> <!-- Menu full -->
<div class="admin-menu-container box-menu sticky top-0 bottom-0 h-[100vh] hidden" id="js-menu-big"> <div class="admin-menu-container box-menu sticky top-0 bottom-0 h-[100vh] hidden" id="js-menu-big">
<a href="javascript:void(0)" class="icon-close" id="js-hide-menu"> <a href="javascript:void(0)" class="icon-close" id="js-hide-menu">
<i class="fa-solid fa-outdent"></i> <i class="fa-solid fa-outdent"></i>
@@ -42,14 +42,14 @@
<div class="menu-list"> <div class="menu-list">
<a href="/" class="item"> <a href="/" class="item">
<i class="icons icon-home"></i> <i class="icons icon-home"></i>
<span class="title"> Home </span> <span class="title"> Dashboard </span>
</a> </a>
{% for _category in global.main_menu %} {% for _category in global.main_menu %}
{% assign _type = _category[0] %} {% assign _type = _category[0] %}
{% assign _menuArray = _category[1].menu %} {% assign _menuArray = _category[1].menu %}
{% if _category[1].enable == 1 %} {% if _category[1].enable == 1 %}
<details {% if _type == global.name %} open {% endif %}> <details {% if _type == global.module %} open {% endif %}>
<summary class="item"> <summary class="item">
<div class="flex items-center"> <div class="flex items-center">
@@ -76,7 +76,7 @@
<div class="sub-menu"> <div class="sub-menu">
{% for _item in _menuArray %} {% for _item in _menuArray %}
<a href="?module={{ _item.module }}&view={{ _item.view }}" {% if _item.view == global.view and <a href="?module={{ _item.module }}&view={{ _item.view }}" {% if _item.view == global.view and
_type == global.name %} class="current" {% endif %}> {{ _item.name }} </a> _type == global.module %} class="current" {% endif %}> {{ _item.name }} </a>
{% endfor %} {% endfor %}
</div> </div>
</details> </details>
@@ -109,7 +109,7 @@
</a> </a>
</div> </div>
<!-- Menu mới --> <!-- Menu collapse -->
<div class="admin-menu box-menu sticky top-0 bg-[#004E99] flex flex-col justify-between pb-[20px] min-h-[100vh]" id="js-menu-small"> <div class="admin-menu box-menu sticky top-0 bg-[#004E99] flex flex-col justify-between pb-[20px] min-h-[100vh]" id="js-menu-small">
<div> <div>
<div class="logo item items-center justify-center border-[rgba(255,255,255,0.15)] border-b p-[20px_0_38px_!important]"> <div class="logo item items-center justify-center border-[rgba(255,255,255,0.15)] border-b p-[20px_0_38px_!important]">
@@ -125,7 +125,7 @@
<a href="/" class="icons icon-home"> </a> <a href="/" class="icons icon-home"> </a>
<div class="sub-menu"> <div class="sub-menu">
<p class="font-bold"> Home </p> <p class="font-bold"> Dashboard </p>
</div> </div>
</div> </div>
@@ -155,7 +155,7 @@
<div class="menu-list"> <div class="menu-list">
{% for _item in _menuArray %} {% for _item in _menuArray %}
<a href="?module={{ _item.module }}&view={{ _item.view }}" {% if _item.view == global.view and <a href="?module={{ _item.module }}&view={{ _item.view }}" {% if _item.view == global.view and
_type == global.name %} class="current" {% endif %}> {{ _item.name }} </a> _type == global.module %} class="current" {% endif %}> {{ _item.name }} </a>
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
@@ -279,4 +279,4 @@
{% include javascript/index %} {% include javascript/index %}
</body> </body>
</html> </html>