Jump to content

Services Status Filter


Recommended Posts

Hello,

I'm editing the Six template and I cannot find how to customize the service status filter for service table.

To clarify: I have created my custom button filters, for the service status and I would like to add the count badges, as View shows in Product & Services page.

https://nimb.ws/MpaeRK

Any suggestion on how to add the count number of each status in my custom buttons ?

I'm using `includes/pageheader.tpl` and bootstrap to create nav-pill buttons and default six template files with few GUI customization 

Edited by pRieStaKos
Link to comment
Share on other sites

1 hour ago, pRieStaKos said:

Any suggestion on how to add the count number of each status in my custom buttons ?

the sidebar should add filters for (default) service statuses that it finds for that client - are you using custom service statuses in some way ?

1 hour ago, pRieStaKos said:

I'm using `includes/pageheader.tpl` and bootstrap to create nav-pill buttons and default six template files with few GUI customization 

are you wanting to add new custom filters to the sidebar or just using buttons elsewhere on the page? either way, i'd be inclined to think that you'll have to query the database to get a count for the current user and  the occurrence of your custom status(es) in  their services.

Link to comment
Share on other sites

14 hours ago, brian! said:

the sidebar should add filters for (default) service statuses that it finds for that client - are you using custom service statuses in some way ?

Not custom service statuses. I'm using the default service statuses.

14 hours ago, brian! said:

the sidebar should add filters for (default) service statuses that it finds for that client - are you using custom service statuses in some way ?

are you wanting to add new custom filters to the sidebar or just using buttons elsewhere on the page? either way, i'd be inclined to think that you'll have to query the database to get a count for the current user and  the occurrence of your custom status(es) in  their services.

Yes. I created custom buttons (bootstrap nav-pills) as filters, at the top right of the table.

Link to comment
Share on other sites

the quick way to get a status count for a particular status in a hook would be...

<?php

# Get Service Count Hook
# Written by brian!

function services_counts_hook($vars)
{	
	$client = Menu::context('client');
	$activeservices = $client->services->where('domainstatus','Active')->count();
	return array("activecount" => $activeservices);
}
add_hook("ClientAreaPageProductsServices", 1, "services_counts_hook");

that will give you an {$activecount} variable you can use in the template to show the number of active services... it should tally with the value in the sidebar (though I assume you aren't showing the sidebar).

if you need other selected status counts, then it's just a case of duplicating that second line, adjusting the domainstatus value and including the result in the return array.

if you need all the status counts in one array and via one query, then i'd probably use capsule/SQL rather than the model method.

Link to comment
Share on other sites

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.

×
×
  • 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