diff --git a/system/controllers/home.php b/system/controllers/home.php
index cf8c5b67..f5b1214c 100644
--- a/system/controllers/home.php
+++ b/system/controllers/home.php
@@ -95,8 +95,7 @@ if (_post('send') == 'balance') {
}
r2(getUrl('home'), 'w', Lang::T('Your friend do not have active package'));
}
-$_bill = User::_billing();
-$ui->assign('_bills', $_bill);
+
// Sync plan to router
if (isset($_GET['sync']) && !empty($_GET['sync'])) {
@@ -310,46 +309,25 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI
}
}
-$tcf = ORM::for_table('tbl_customers_fields')
- ->where('customer_id', $user['id'])
- ->find_many();
-$vpn = ORM::for_table('tbl_port_pool')
- ->find_one();
-$ui->assign('cf', $tcf);
-$ui->assign('vpn', $vpn);
-$unpaid = ORM::for_table('tbl_payment_gateway')
- ->where('username', $user['username'])
- ->where('status', 1)
- ->find_one();
-
-// check expired payments
-if ($unpaid) {
- try {
- if (strtotime($unpaid['expired_date']) < time()) {
- $unpaid->status = 4;
- $unpaid->save();
- $unpaid = [];
+$widgets = ORM::for_table('tbl_widgets')->where("enabled", 1)->where('user', 'Customer')->order_by_asc("orders")->findArray();
+$count = count($widgets);
+for ($i = 0; $i < $count; $i++) {
+ try{
+ if(file_exists($WIDGET_PATH . DIRECTORY_SEPARATOR . 'customer' . DIRECTORY_SEPARATOR . $widgets[$i]['widget'].".php")){
+ require_once $WIDGET_PATH . DIRECTORY_SEPARATOR . 'customer' . DIRECTORY_SEPARATOR . $widgets[$i]['widget'].".php";
+ $widgets[$i]['content'] = (new $widgets[$i]['widget'])->getWidget($widgets[$i]);
+ }else{
+ $widgets[$i]['content'] = "Widget not found";
}
} catch (Throwable $e) {
- } catch (Exception $e) {
- }
- try {
- if (strtotime($unpaid['created_date'], "+24 HOUR") < time()) {
- $unpaid->status = 4;
- $unpaid->save();
- $unpaid = [];
- }
- } catch (Throwable $e) {
- } catch (Exception $e) {
+ $widgets[$i]['content'] = $e->getMessage();
}
}
-$ui->assign('unpaid', $unpaid);
-$ui->assign('code', alphanumeric(_get('code'), "-"));
+$ui->assign('widgets', $widgets);
-$abills = User::getAttributes("Bill");
-$ui->assign('abills', $abills);
+$ui->assign('code', alphanumeric(_get('code'), "-"));
run_hook('view_customer_dashboard'); #HOOK
$ui->display('customer/dashboard.tpl');
diff --git a/system/widgets/customer/account_info.php b/system/widgets/customer/account_info.php
new file mode 100644
index 00000000..53cb953c
--- /dev/null
+++ b/system/widgets/customer/account_info.php
@@ -0,0 +1,14 @@
+assign('abills', $abills);
+ return $ui->fetch('widget/customers/account_info.tpl');
+ }
+}
diff --git a/system/widgets/customer/active_internet_plan.php b/system/widgets/customer/active_internet_plan.php
new file mode 100644
index 00000000..8bf0501f
--- /dev/null
+++ b/system/widgets/customer/active_internet_plan.php
@@ -0,0 +1,20 @@
+assign('_bills', $_bill);
+ $tcf = ORM::for_table('tbl_customers_fields')
+ ->where('customer_id', $user['id'])
+ ->find_many();
+ $vpn = ORM::for_table('tbl_port_pool')
+ ->find_one();
+ $ui->assign('cf', $tcf);
+ $ui->assign('vpn', $vpn);
+ return $ui->fetch('widget/customers/active_internet_plan.tpl');
+ }
+}
diff --git a/system/widgets/customer/announcement.php b/system/widgets/customer/announcement.php
new file mode 100644
index 00000000..348cd368
--- /dev/null
+++ b/system/widgets/customer/announcement.php
@@ -0,0 +1,11 @@
+fetch('widget/customers/announcement.tpl');
+ }
+}
diff --git a/system/widgets/customer/balance_transfer.php b/system/widgets/customer/balance_transfer.php
new file mode 100644
index 00000000..e424c20f
--- /dev/null
+++ b/system/widgets/customer/balance_transfer.php
@@ -0,0 +1,11 @@
+fetch('widget/customers/balance_transfer.tpl');
+ }
+}
diff --git a/system/widgets/customer/button_order_internet_plan.php b/system/widgets/customer/button_order_internet_plan.php
new file mode 100644
index 00000000..5e6bc4f5
--- /dev/null
+++ b/system/widgets/customer/button_order_internet_plan.php
@@ -0,0 +1,11 @@
+fetch('widget/customers/button_order_internet_plan.tpl');
+ }
+}
diff --git a/system/widgets/customer/html_only.php b/system/widgets/customer/html_only.php
new file mode 100644
index 00000000..b7131c01
--- /dev/null
+++ b/system/widgets/customer/html_only.php
@@ -0,0 +1,11 @@
+assign('card_header', $data['title']);
+ ob_start();
+ try{
+ eval('?>'. $data['content']);
+ }catch(Exception $e){
+ echo $e->getMessage();
+ echo "
";
+ echo $e->getTraceAsString();
+ }
+ $content = ob_get_clean();
+ $ui->assign('card_body', $content);
+ return $ui->fetch('widget/card_html.tpl');
+ }
+}
\ No newline at end of file
diff --git a/system/widgets/customer/recharge_a_friend.php b/system/widgets/customer/recharge_a_friend.php
new file mode 100644
index 00000000..5d6ccb45
--- /dev/null
+++ b/system/widgets/customer/recharge_a_friend.php
@@ -0,0 +1,11 @@
+fetch('widget/customers/recharge_a_friend.tpl');
+ }
+}
diff --git a/system/widgets/customer/unpaid_order.php b/system/widgets/customer/unpaid_order.php
new file mode 100644
index 00000000..b4b5abbd
--- /dev/null
+++ b/system/widgets/customer/unpaid_order.php
@@ -0,0 +1,39 @@
+where('username', $user['username'])
+ ->where('status', 1)
+ ->find_one();
+
+ // check expired payments
+ if ($unpaid) {
+ try {
+ if (strtotime($unpaid['expired_date']) < time()) {
+ $unpaid->status = 4;
+ $unpaid->save();
+ $unpaid = [];
+ }
+ } catch (Throwable $e) {
+ } catch (Exception $e) {
+ }
+ try {
+ if (strtotime($unpaid['created_date'], "+24 HOUR") < time()) {
+ $unpaid->status = 4;
+ $unpaid->save();
+ $unpaid = [];
+ }
+ } catch (Throwable $e) {
+ } catch (Exception $e) {
+ }
+ }
+
+ $ui->assign('unpaid', $unpaid);
+ return $ui->fetch('widget/customers/unpaid_order.tpl');
+ }
+}
diff --git a/system/widgets/customer/voucher_activation.php b/system/widgets/customer/voucher_activation.php
new file mode 100644
index 00000000..5674feeb
--- /dev/null
+++ b/system/widgets/customer/voucher_activation.php
@@ -0,0 +1,11 @@
+fetch('widget/customers/voucher_activation.tpl');
+ }
+}
diff --git a/ui/ui/customer/dashboard.tpl b/ui/ui/customer/dashboard.tpl
index 6cf5aa89..53efb76a 100644
--- a/ui/ui/customer/dashboard.tpl
+++ b/ui/ui/customer/dashboard.tpl
@@ -1,436 +1,39 @@
{include file="customer/header.tpl"}
-
-
- {if $unpaid }
-
-
-
-
-
-
- {Lang::T('expired')} |
- {Lang::dateTimeFormat($unpaid['expired_date'])} |
-
-
- {Lang::T('Package Name')} |
- {$unpaid['plan_name']} |
-
-
- {Lang::T('Package Price')} |
- {$unpaid['price']} |
-
-
- {Lang::T('Routers')} |
- {$unpaid['routers']} |
-
-
-
-
-
-
+{function showWidget pos=0}
+ {foreach $widgets as $w}
+ {if $w['position'] == $pos}
+ {$w['content']}
{/if}
-
-
-
- {$Announcement_Customer = "{$PAGES_PATH}/Announcement_Customer.html"}
- {if file_exists($Announcement_Customer)}
- {include file=$Announcement_Customer}
- {/if}
+ {/foreach}
+{/function}
+
+
+{assign rows explode(".", $_c['dashboard_Customer'])}
+{assign pos 1}
+{foreach $rows as $cols}
+ {if $cols == 12}
+
+
+ {showWidget widgets=$widgets pos=$pos}
-
-
-
-
-
- {if $abills && count($abills)>0}
-
-
+ {/if}
+{/foreach}
+
+
{if isset($hostname) && $hchap == 'true' && $_c['hs_auth_method'] == 'hchap'}
+ {/if}
+ {/foreach}
+{/if}
\ No newline at end of file
diff --git a/ui/ui/widget/customers/announcement.tpl b/ui/ui/widget/customers/announcement.tpl
new file mode 100644
index 00000000..8525df4d
--- /dev/null
+++ b/ui/ui/widget/customers/announcement.tpl
@@ -0,0 +1,11 @@
+
+
+
+ {$Announcement_Customer = "{$PAGES_PATH}/Announcement_Customer.html"}
+ {if file_exists($Announcement_Customer)}
+ {include file=$Announcement_Customer}
+ {/if}
+
+
\ No newline at end of file
diff --git a/ui/ui/widget/customers/balance_transfer.tpl b/ui/ui/widget/customers/balance_transfer.tpl
new file mode 100644
index 00000000..f7db2bd8
--- /dev/null
+++ b/ui/ui/widget/customers/balance_transfer.tpl
@@ -0,0 +1,38 @@
+
+{if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes'}
+
+{/if}
\ No newline at end of file
diff --git a/ui/ui/widget/customers/button_order_internet_plan.tpl b/ui/ui/widget/customers/button_order_internet_plan.tpl
new file mode 100644
index 00000000..93393110
--- /dev/null
+++ b/ui/ui/widget/customers/button_order_internet_plan.tpl
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/ui/ui/widget/customers/recharge_a_friend.tpl b/ui/ui/widget/customers/recharge_a_friend.tpl
new file mode 100644
index 00000000..e0705f19
--- /dev/null
+++ b/ui/ui/widget/customers/recharge_a_friend.tpl
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/ui/ui/widget/customers/unpaid_order.tpl b/ui/ui/widget/customers/unpaid_order.tpl
new file mode 100644
index 00000000..a49bb469
--- /dev/null
+++ b/ui/ui/widget/customers/unpaid_order.tpl
@@ -0,0 +1,48 @@
+{if $unpaid }
+
+
+
+
+
+
+ {Lang::T('expired')} |
+ {Lang::dateTimeFormat($unpaid['expired_date'])} |
+
+
+ {Lang::T('Package Name')} |
+ {$unpaid['plan_name']} |
+
+
+ {Lang::T('Package Price')} |
+ {$unpaid['price']} |
+
+
+ {Lang::T('Routers')} |
+ {$unpaid['routers']} |
+
+
+
+
+
+
+{/if}
\ No newline at end of file
diff --git a/ui/ui/widget/customers/voucher_activation.tpl b/ui/ui/widget/customers/voucher_activation.tpl
new file mode 100644
index 00000000..bb43c29d
--- /dev/null
+++ b/ui/ui/widget/customers/voucher_activation.tpl
@@ -0,0 +1,38 @@
+
+{if $_c['disable_voucher'] != 'yes'}
+
+{/if}
\ No newline at end of file