-
Notifications
You must be signed in to change notification settings - Fork 0
/
Credit_Balance.php
27 lines (23 loc) · 1.31 KB
/
Credit_Balance.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
/**
* Adds the option to view Credit Balance in WHMCS (Client View - https://i.imgur.com/C3imJc7.png)
*
* @package WHMCS
* @copyright ItsLeon15
* @link https://www.platinumhost.xyz
* @author Leon <[email protected]>
*/
use WHMCS\View\Menu\Item as MenuItem;
add_hook('ClientAreaPrimarySidebar', 1, function (MenuItem $primarySidebar) {
$filename = basename($_SERVER['REQUEST_URI'], ".php");
$parseFile = explode('.', $filename);
$client = Menu::context("client");
$clientid = intval($client->id);
if ($parseFile['0'] !== 'clientarea' || $clientid === 0) {
return;
}
$primarySidebar->addChild('Client-Balance', array('label' => Lang::trans('availcreditbal'), 'uri' => '#', 'order' => '1', 'icon' => 'fa-money'));
$balancePanel = $primarySidebar->getChild('Client-Balance')->moveToBack()->setOrder(0);
$balancePanel->addChild('balance-amount', array('uri' => 'clientarea.php?action=addfunds"style="background-color: transparent !important', 'label' => '<h4 style="text-align:center; margin:0">' . formatcurrency($client->credit, $client->currencyId) . '</h4>', 'order' => 1));
$balancePanel->setFooterHtml('<a href="clientarea.php?action=addfunds" class="btn btn-success btn-sm btn-block"><i class="fa fa-plus"></i> ' . Lang::trans('addfunds') . '</a>');
});