Notifications

Overview #

Sometime you will need to send message to user or to ask them to confirm an action. Notification components are allow you to do so.

Example:

use \koolreport\dashboard\notifications\Alert;

...
protected function actionSubmit($request, $response)
{
    // Inside any server-side action of dashboard, you can return notification

    if($success) {
        return Alert::success("Your request has been done!","Success");
    } else {
        return Alert::danger("Could not complete your request!","Error");
    }    
}

Alert #

Alert is used to notify user about something, it use a big modal to show message in middle of screen to catch attention of user.

Properties #

Nametypedefaultdescription
confirmButtonTextstringGet/set the confirm button text

Examples #

use \koolreport\dashboard\notifications\Alert;

...
Alert::danger("Error happened", "Opps");
Alert::success("Congratulation for whatever success", "Success title");
Alert::warnings("Warning somethin about to happen", "Warning title");
Alert::info("Information is important", "Information title");
Alert::default("Message in gray", "Something in title");

Confirm #

Confirm is another type of notification that will ask user to confirm or cancel an action.

use \koolreport\dashboard\notifications\Alert;
...
Confirm::danger("Do you want to take this action?","Confirmation")
    ->onConfirm("alert('Do something')");

Properties #

Nametypedefaultdescription
confirmButtonTextstringGet/set the confirm button text
cancelButtonTextstringGet/set the cancel button text
onConfirmstringGet/set javascript to run when user hit confirm
onCancelstringGet/set javascript to run when user hit cancel

Examples #

Confirm::primary("Do you want to take this action?")
    ->confirmButtonText("I agree")
    ->cancelButtonText("Decline")
    ->onConfirm("alert('Take action')")
    ->onCancel("alert('Action is cancelled')");

There are 6 types of confirmation "primary", "info", "success", "warning", "danger" and "default" that you may use.

Note #

Note is very similar to Alert and its open location can be customized.

Properties #

Nametypedefaultdescription
typestringAccept "primary", "info", "success", "warning", "danger"
textstringGet/set the body text
titlestringGet/set the title text
positionstringAccept 1"top-right", "bottom-right", "bottom"-left", "top-left", "top-center", "bottom-center"`
closeButtonboolGet/set whether close button is shown
progressBarboolGet/set whether progress bar is used
newestOnTopboolGet/set whether the newest note is on top

Examples #

use \koolreport\dashboard\notifications\Note;

...
Note::danger("Error happened", "Opps");
Note::success("Congratulation for whatever success", "Success title");
Note::warnings("Warning somethin about to happen", "Warning title");
Note::info("Information is important", "Information title");
Note::default("Message in gray", "Something in title");

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.