Progress Last updated: 2023-09-17

The Progress object is designed to calculate the percentage of remaining values for a set of tasks that haven't been completed yet. It provides a convenient way to track and visualize the progress of incomplete tasks.

By utilizing the Progress object, you can input a set of tasks or values and track the completion status of each task. The object then calculates the percentage of remaining values based on the number of incomplete tasks compared to the total number of tasks.

This functionality allows you to monitor the progress of your tasks and determine how much work is left to be done. It provides a clear indication of the percentage of tasks that still need attention, enabling you to prioritize and allocate resources effectively.

The Progress object is particularly useful for project management, goal tracking, or any situation where you need to measure the completion status of a set of tasks. By visualizing the remaining percentage, you can stay motivated and focused on completing your objectives.

In summary, the Progress object calculates the percentage of remaining values for a set of tasks that haven't been completed yet. It helps you track and visualize the progress of incomplete tasks, enabling effective project management and goal tracking.

 

Example:

An object can be created using the command

php artisan dash:progress Users 
#[app/Dash/Metrics/Progress/Users.php]
#Users Progress generated
# or write --module flag to Create in specific module
php artisan dash:progress Users --module=Users

output:

<?php
namespace App\Dash\Metrics\Progress;
use Dash\Extras\Metrics\Progress;

class Users extends Progress{

    /**
     * calculate method is short to calc to using in value
     * for more information about this visit https://phpdash.com/docs/1.x/Metrics#Value
     * @return $this->progress method
     *
     */
      public function calc(){
        return  $this->progress(YourModel::class,function($query){
            $query->where('yourColumn','!=',null);// you can add more query or by relations
        })
       // ->bgClass('bg-success') change bar background color optional // bg-success , bg-info , bg-warning , bg-danger
       // ->at('created_at') // optional
       // ->column(3) // optional
       // ->height('10') change bar height optional // 0 to 100
       // ->href(dash('resource/YourResourceOr Other Links'))
       // ->icon('<i class="fa fa-users"></i>') icon by fontawesome or other | optional
       // ->title('Your Title') // optional
       // ->subTitle('Your subTitle') optional
       //  ->textBody('Text In Body') // optional
       // ->prefix('<i class="fa fa-user"></i> ') add prefix before number or icon
       // ->suffix('Your suffix') // optional add suffix after number
       ;
    }

}

 

How to Use ?
You Can Use In Vertex In Resource or Dashboard Class with →render() method like this :- 

<?php
namespace App\Dash\Dashboard;
use App\Dash\Metrics\Progress\Users;

use Dash\Resource;

class Help extends Resource {

	/**
	 * add your card here by Card , HTML Class
	 * or by view instnance render blade file
	 * @return array
	 */
	public static function cards() {
		return [
                 (new Users)->render(),
                   // or if you need to reformat value 
                 (new Users)->formatValue(function($value){
             					   return number_format($value,2);
            			    })->render(),
		];
	}

}