Widget For Customer

This commit is contained in:
iBNu Maksum
2025-02-21 16:01:46 +07:00
parent 8d2c334da0
commit 19a48c0c88
20 changed files with 621 additions and 459 deletions

View File

@ -0,0 +1,14 @@
<?php
class account_info
{
public function getWidget()
{
global $ui;
$abills = User::getAttributes("Bill");
$ui->assign('abills', $abills);
return $ui->fetch('widget/customers/account_info.tpl');
}
}

View File

@ -0,0 +1,20 @@
<?php
class active_internet_plan
{
public function getWidget()
{
global $ui, $user;
$_bill = User::_billing();
$ui->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');
}
}

View File

@ -0,0 +1,11 @@
<?php
class announcement
{
public function getWidget()
{
global $ui;
return $ui->fetch('widget/customers/announcement.tpl');
}
}

View File

@ -0,0 +1,11 @@
<?php
class balance_transfer
{
public function getWidget()
{
global $ui;
return $ui->fetch('widget/customers/balance_transfer.tpl');
}
}

View File

@ -0,0 +1,11 @@
<?php
class button_order_internet_plan
{
public function getWidget()
{
global $ui;
return $ui->fetch('widget/customers/button_order_internet_plan.tpl');
}
}

View File

@ -0,0 +1,11 @@
<?php
class html_only
{
public function getWidget($data = null)
{
global $ui;
return $data['content'];
}
}

View File

@ -0,0 +1,22 @@
<?php
class html_php
{
public function getWidget($data = null)
{
global $ui;
$ui->assign('card_header', $data['title']);
ob_start();
try{
eval('?>'. $data['content']);
}catch(Exception $e){
echo $e->getMessage();
echo "<br>";
echo $e->getTraceAsString();
}
$content = ob_get_clean();
$ui->assign('card_body', $content);
return $ui->fetch('widget/card_html.tpl');
}
}

View File

@ -0,0 +1,11 @@
<?php
class recharge_a_friend
{
public function getWidget()
{
global $ui;
return $ui->fetch('widget/customers/recharge_a_friend.tpl');
}
}

View File

@ -0,0 +1,39 @@
<?php
class unpaid_order
{
public function getWidget()
{
global $ui, $user;
$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 = [];
}
} 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');
}
}

View File

@ -0,0 +1,11 @@
<?php
class voucher_activation
{
public function getWidget()
{
global $ui;
return $ui->fetch('widget/customers/voucher_activation.tpl');
}
}