Jump to content

v8.0.1 Admin Info Stats Bar


Recommended Posts

10 minutes ago, m107 said:

@brian! yeah, actually got more complicated :))

it got slightly simpler - in that now there is only one incorrect value and not two. 🙂

my suspicion is that there is something unique at play here - could be a third-party addon; some corruption in the tables; pending orders not being accepted in the right way.... for it to be 200+ out, that implies that whatever is causing this has been occurring for a while - i've no idea what it could be! 😕

Link to comment
Share on other sites

16 hours ago, m107 said:

Hmm, anyway to change the number to paid pending orders?

you could query the database for the result, but bear in mind (pedantic point coming!) that orders don't get paid, their invoices do, e.g there are scenarios where you could generate an order that doesn't have an invoice and so wouldn't be included in any such query.

$pendingorders = Capsule::table('tblorders')->join('tblinvoices','tblorders.invoiceid','=','tblinvoices.id')->where('tblorders.status','Pending')->where('tblinvoices.status','Paid')->count();
Link to comment
Share on other sites

On 12/2/2020 at 4:32 PM, brian! said:

you could query the database for the result, but bear in mind (pedantic point coming!) that orders don't get paid, their invoices do, e.g there are scenarios where you could generate an order that doesn't have an invoice and so wouldn't be included in any such query.


$pendingorders = Capsule::table('tblorders')->join('tblinvoices','tblorders.invoiceid','=','tblinvoices.id')->where('tblorders.status','Pending')->where('tblinvoices.status','Paid')->count();

Worked! It is working man!

Link to comment
Share on other sites

  • 1 month later...

Brian wins again !

is there any way to get that search bar from WHMCS 7 along with your this hook?   (not going all back to 7 totally)

(why WHMCS is going backward so much)?

WHMCS8 needs to click first to enter search terms, yes one more click does matter hugely when you get busy

2021-1-28 下午 12-23-53.jpg

Link to comment
Share on other sites

3 hours ago, hoya8 said:

is there any way to get that search bar from WHMCS 7 along with your this hook?   (not going all back to 7 totally)

I think my plan was to do that as an option when I publish the menu addon...

cWnj25w.png

one of the few things that makes me close to swearing about WHMCS is the idiotic menu system in v8 - the amount of time I waste because i've now got to go around the houses to get to the page I want in the admin area is just insane... surely, it's not rocket science to make a navigation menu that is sensible and not require multiple page clicks or searching.

Link to comment
Share on other sites

I  was also really shocked some of the issues (and features requested YES,) have been pending for YEARS

Then every time they published new version, they simply go backward to make people create more "feature requests" that seems always pending

Link to comment
Share on other sites

so we have have

 Pending Orders | Overdue Invoices |  Ticket(s) Awaiting Reply  

on top, does anyone know that how to add one more item based on WHMCS 8.1- system setting -> "custom ticket status" ? 

such as

 Pending Orders | Overdue Invoices |  Ticket(s) Awaiting Reply   |  waiting for billing dept

thanks!

Link to comment
Share on other sites

3 hours ago, hoya8 said:

on top, does anyone know that how to add one more item based on WHMCS 8.1- system setting -> "custom ticket status" ? 

it should just require a db lookup to get the count for your ticket conditions, e.g custom status, similar to some of the existing queries... almost certainly, that value won't be available by default and it will be need to be obtained from the database.

Link to comment
Share on other sites

Hello,

Brian! frist thank you, this was a nightmare for me not having this.

I optimize it a bit for mobile ...etc for those who need it.

	<style>
	#infostats {
	float: right; 
	padding: 15px; 
	position: absolute; 
	width: 83%; 
	max-height: 20px;
	text-align: right; 
	}
  @media screen and (max-width: 500px) {

  #infostats {
  width: 100%;  
  position: relative;
  padding-top: 10px;
  padding-bottom: 25px;
  background-color: #1a4d80;
  text-align: center;
  }

}

  </style>
	
	<div id="infostats">
			<div style="color: #fff; font-size: .8em; margin: 0;">
				<a href="orders.php?status=Pending" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$pendingorders.'</span> '.AdminLang::trans('stats.pendingorders').'</a> |
				<a href="invoices.php?status=Overdue" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$overdueinvoices.'</span> '.AdminLang::trans('stats.overdueinvoices').'</a> |
				<a href="supporttickets.php" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$ticketsawaiting.'</span> '.AdminLang::trans('stats.ticketsawaitingreply').'</a>
			</div>
		</div>

 

whmcs.thumb.png.53a4ff50eed4d9ed8c07dc8cd2d36118.png

Edited by Bidi
Link to comment
Share on other sites

1 minute ago, hoya8 said:

hey Bidi

thanks for this.

I just tried it  and liked the layout but logo of "WHMCS" 'is gone, not click-able to let us going back to index page, any way to add it back please?

 

thanks

I sow now, i will edit my post, i fix it now 🙂

Edited by Bidi
Link to comment
Share on other sites

HI Bidi

so to be like this, but WHMCS logo is still not url-enabled 🙂

 

<?php

# Stats Info Bar for v8 Blend
# Written by brian!

use WHMCS\Database\Capsule;
use WHMCS\Billing\Invoice;
use Carbon\Carbon;

function admin_v8_infobar_hook($vars) {
	
	if ($vars['template'] == "blend") {
		$pendingstatuslist = Capsule::table('tblorderstatuses')->where('showpending','1')->pluck('title');
		$pendingorders = Capsule::table('tblorders')->whereIn('status',$pendingstatuslist)->count();
		$overdueinvoices = Invoice::overdue()->count();
		$awaitingreplylist = Capsule::table('tblticketstatuses')->where('showawaiting','1')->pluck('title');
		$ticketsawaiting = Capsule::table('tbltickets')->whereIn('status',$awaitingreplylist)->where('merged_ticket_id','0')->count();
		$current_time = Carbon::now()->translatedFormat("l, j F Y, H:i");
		$headerreturn = '<style>
	#infostats {
	float: right; 
	padding: 15px; 
	position: absolute; 
	width: 83%; 
	max-height: 20px;
	text-align: right; 
	}
  @media screen and (max-width: 500px) {

  #infostats {
  width: 100%;  
  position: relative;
  padding-top: 10px;
  padding-bottom: 25px;
  background-color: #1a4d80;
  text-align: center;
  }

}

  </style>
	
	<div id="infostats">
			<div style="color: #fff; font-size: .8em; margin: 0;">
				<a href="orders.php?status=Pending" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$pendingorders.'</span> '.AdminLang::trans('stats.pendingorders').'</a> |
				<a href="invoices.php?status=Overdue" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$overdueinvoices.'</span> '.AdminLang::trans('stats.overdueinvoices').'</a> |
				<a href="supporttickets.php" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$ticketsawaiting.'</span> '.AdminLang::trans('stats.ticketsawaitingreply').'</a>
			</div>
		</div>';
		return $headerreturn;
		
		
		
		
	}
}
add_hook("AdminAreaHeaderOutput",1,"admin_v8_infobar_hook");

 

Link to comment
Share on other sites

13 minutes ago, Bidi said:

Yes but i whant to fix it 🙂 so i try to fix it now, i hope i can 🙂

<?php

# Stats Info Bar for v8 Blend
# Written by brian!

use WHMCS\Database\Capsule;
use WHMCS\Billing\Invoice;
use Carbon\Carbon;

function admin_v8_infobar_hook($vars) {
	
	if ($vars['template'] == "blend") {
		$pendingstatuslist = Capsule::table('tblorderstatuses')->where('showpending','1')->pluck('title');
		$pendingorders = Capsule::table('tblorders')->whereIn('status',$pendingstatuslist)->count();
		$overdueinvoices = Invoice::overdue()->count();
		$awaitingreplylist = Capsule::table('tblticketstatuses')->where('showawaiting','1')->pluck('title');
		$ticketsawaiting = Capsule::table('tbltickets')->whereIn('status',$awaitingreplylist)->where('merged_ticket_id','0')->count();
		$current_time = Carbon::now()->translatedFormat("l, j F Y, H:i");
		$headerreturn = '
		
		
			<style>
	#infostats {
	float: right; 
	padding: 15px; 
	position: absolute; 
	width: 83%; 
	max-height: 20px;
	text-align: right; 
	}
  #infostats2 {
  width: 50%; float: right;color: #fff; color: #fff; font-size: .8em; margin: 0;
  }
  #logoul {
  width: 125px; 
  float:left; 
  margin-top: -6px; 
  margin-left: 20px;
  }
  
  @media screen and (max-width: 1300px) {

  #infostats {
  width: 100%;  
  position: relative;
  padding-top: 10px;
  padding-bottom: 25px;
  background-color: #1a4d80;
  text-align: center;
  }
  #infostats2 {
  width: 100%; color: #fff; color: #fff; font-size: .8em; margin: 0;
  }
  #logoul {
  display: none;
  }
  
}

  </style>
	
	<div id="infostats">

<a href="index.php" class="logo" title="Home">
    <img src="templates/blend/images/logo.png" id="logoul">
</a>


			<div id="infostats2"style="">
				<a href="orders.php?status=Pending" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$pendingorders.'</span> '.AdminLang::trans('stats.pendingorders').'</a> |
				<a href="invoices.php?status=Overdue" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$overdueinvoices.'</span> '.AdminLang::trans('stats.overdueinvoices').'</a> |
				<a href="supporttickets.php" style="color: #fff;"><span style="font-weight: 700; color: #fc0;">'.$ticketsawaiting.'</span> '.AdminLang::trans('stats.ticketsawaitingreply').'</a>
			</div>
		</div>';
		return $headerreturn;
	}
}
add_hook("AdminAreaHeaderOutput",1,"admin_v8_infobar_hook");

Done now 🙂 is working for me om mobile, tablet, laptop, pc ...etc

Edited by Bidi
Link to comment
Share on other sites

4 minutes ago, Bidi said:

Done, go ahead test it for me works good on mobile, my laptop, tablet..etc

9taxAA0.png

you're over-engineering this... there were many reasons why I didn't try to do this in the original code.

2 minutes ago, hoya8 said:

It now showed some line and odds around logo like this

he's referencing an image that he must have uploaded locally, or the url is wrong...

Link to comment
Share on other sites

Change image url with the one belong, brian! he can help us with a php code whmcs for templates/blend/images/logo.png to get it right from templateurl, i know there was sompting like $themeurl 🙂 i dont remember but this is the only problem url of the logo, i`m on a coffe making this just for make it nice .

I added the same logo of whmcs on top of my code div 🙂

 <img src="templates/blend/images/logo.png" id="logoul">
Edited by Bidi
Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated