Jump to content

Enhanced ToDo List Admin Widget


brian!

Recommended Posts

the idea for this widget was started in the feedback thread below, but rather than hijack that thread with this project, it was easier to start a new thread in Third Party Addons.

this "Enhanced ToDo List" admin widget, expands on the default widget by showing client names (or Company Name), service details (name/domain) and domain names as mouseover tooltips (I could put them in the body, but then space might become an issue)...

AaNGIDJ.png

for those that want to use this widget, i've attached it to this post - simply upload to /modules/widgets and the next time you go to the admin homepage, it should be there (assuming your admin role allows viewing of the ToDo List).

i've called the file "EnhancedToDo.php", so you'll end up with two ToDo widgets on your homepage, just disable the default one using the Show/Hide widgets option top right... I could have called it ToDo.php, but then the WHMCS auto-updater would have overwritten it during the next update - so it's easier to keep it separate until WHMCS improve how they handle ToDo's. waiting.gif

FHsY76S.png

it's written for WHMCS v7.6, but will work on v7.5.x too... it might work on earlier v7 versions, but I haven't tested it on them - there is a WHMCS version check inside the widget that chooses FontAwesome 5 icons if using v7.6 or later, or FA4 if using an earlier WHMCS version.

if you spot any ToDo's that don't behave correctly (e.g a third-party addon might add a ToDo that doesn't follow the WHMCS convention), then feel free to reply about it (or PM me) - it shouldn't break the output, it will likely just not show the icon(s) for that ToDo.

EnhancedToDo.php

Edited by brian!
Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...

Hi @brian!

I tried downloaded the EnhancedToDo php, however it appears it is either no longer available for download, or I do not have sufficient permissions to download the file.

Is it still available for download? This is exactly what I need for our addons.

I am currently using a customized ticket hook (downloaded) but would ideally like to create a To Do item instead.

I'm not a developer so have no idea how to go about creating something like this LOL

Link to comment
Share on other sites

Hi @PixieLinxie

14 hours ago, PixieLinxie said:

I tried downloaded the EnhancedToDo php, however it appears it is either no longer available for download, or I do not have sufficient permissions to download the file.

Is it still available for download? This is exactly what I need for our addons. 

i've just uploaded the file again - can you try the link to see if it works now...

Link to comment
Share on other sites

  • 1 year later...
On 4/30/2019 at 5:43 AM, Nicky said:

Thanks for this. Any idea how to make it sort by due date, rather than date created?

I too have downloaded this to compare
However in 8.0.4 it looks identical
 

When I amend the line to
$toDo = Capsule::table('tbltodolist')->whereIn('status', ['Incomplete', 'New', 'Pending'])->orderBy('duedate', 'asc')->take(11)->get();
All I get is 
No Incomplete Items
Add To Do Item

Link to comment
Share on other sites

5 hours ago, m8internet said:

I too have downloaded this to compare
However in 8.0.4 it looks identical

they won't be identical, but similar - the difference should be the icon to show which domain/service it is referencing...

TG8Jrel.png

and you would never need to enable both widgets - only one of them.

5 hours ago, m8internet said:

When I amend the line to
$toDo = Capsule::table('tbltodolist')->whereIn('status', ['Incomplete', 'New', 'Pending'])->orderBy('duedate', 'asc')->take(11)->get();
All I get is 
No Incomplete Items
Add To Do Item

that makes sense because the function would then be returning an empty array - it's written to use the API to get the ToDo List, so if you're going to change it to use Capsule, then many other changes to the widget code would need to be added... which would likely be along the lines of Steph's changes to the original default ToDo widget code.

Link to comment
Share on other sites

On 12/6/2020 at 3:01 PM, brian! said:

they won't be identical, but similar - the difference should be the icon to show which domain/service it is referencing...

TG8Jrel.png

and you would never need to enable both widgets - only one of them.

I have disabled, enabled, and replaced
There is no change, they are both identical

Link to comment
Share on other sites

4 hours ago, m8internet said:

There is no change, they are both identical

then you only need to use one of them! 😎

i've had to see what you're seeing, but if the list only contained items that the enhanced version wasn't filtering on, then under those circumstances, they would looks the same.

Link to comment
Share on other sites

19 hours ago, m8internet said:

Downloaded again, no modifications, this is what I see; they are both identical

looking at that screenshot, it's working as intended - the widget wasn't originally coded to react to manual domain renewals...

you could change...

if ($title == 'Manual Domain Registration' || $title == 'Manual Domain Transfer' || $title == 'Domain Pending Transfer') {	

to...

if (in_array($title,array('Manual Domain Registration','Manual Domain Transfer','Domain Pending Transfer','Manual Domain Renewal'))) {

and that should fix it.

there's also a bug with the Client being displayed when there shouldn't be one, but that's easily fixable and i'll update the widget at some point.

Link to comment
Share on other sites

12 hours ago, brian! said:

looking at that screenshot, it's working as intended - the widget wasn't originally coded to react to manual domain renewals..

Yes, that has solved the issue and the difference is now clear to see

How do you modify the code so that the renewals are shown with the most recent first?

Link to comment
Share on other sites

7 hours ago, m8internet said:

How do you modify the code so that the renewals are shown with the most recent first?

both widgets use the ToDo API to get the results - and those results are always returned in descending due date order.

if you wanted to show them by date added (though their due dates might not necessarily be in the same order), then I wouldn't use the API - I would just do a basic capsule query to the database by changing...

        $toDo = localAPI('GetToDoItems', array('status' => 'Incomplete', 'limitstart' => 0, 'limitnum' => 11));
        return (isset($toDo['items']['item'])) ? $toDo['items']['item'] : [];

to...

        $toDoQuery = Capsule::table('tbltodolist')->whereNotIn('status',['Completed'])->latest('date')->take(11)->get();
        $toDo = json_decode(json_encode($toDoQuery), true);
        return (isset($toDo)) ? $toDo : [];

A4c8jxi.png

Link to comment
Share on other sites

$toDoQuery = Capsule::table('tbltodolist')->whereNotIn('status',['Completed'])->take(11)->get();
        $toDo = json_decode(json_encode($toDoQuery), true);
        return (isset($toDo)) ? $toDo : [];

Amending as above, and now the items are in date order, soonest to latest
Removed :
->latest('date')

Edited by m8internet
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