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 #
Name | type | default | description |
---|---|---|---|
confirmButtonText | string | Get/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 #
Name | type | default | description |
---|---|---|---|
confirmButtonText | string | Get/set the confirm button text | |
cancelButtonText | string | Get/set the cancel button text | |
onConfirm | string | Get/set javascript to run when user hit confirm | |
onCancel | string | Get/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 #
Name | type | default | description |
---|---|---|---|
type | string | Accept "primary" , "info" , "success" , "warning" , "danger" | |
text | string | Get/set the body text | |
title | string | Get/set the title text | |
position | string | Accept 1"top-right", "bottom-right", "bottom"-left", "top-left", "top-center", "bottom-center"` | |
closeButton | bool | Get/set whether close button is shown | |
progressBar | bool | Get/set whether progress bar is used | |
newestOnTop | bool | Get/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.