KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Using Amazing Cards on Dashboard #2796

Closed GHSix opened this topic on on Aug 18, 2022 - 5 comments

GHSix commented on Aug 18, 2022

I tried to create a SimpleCard inside a dashboard but can't get it to display correctly. I'm I doing it right by using KWidget here?

Card example:

<?php

namespace Main;

use \koolreport\dashboard\widgets\KWidget;

class MainCard extends KWidget
{
    use \koolreport\amazing\Theme;
    
    protected function onInit()
    {
        $this
            ->use(\koolreport\amazing\SimpleCard::class)
            ->settings([
                "title"=>"Income",
                "value"=>7500,
                "cssClass"=>array(
                    "icon"=>"fa fa-dollar"
                )
            ]);
    }

}

Result:

It seems it's mising some CSS but I see no errors on browser dev console.

KoolReport commented on Aug 18, 2022

You try:

 "icon"=>"fas fa-dollar-sign"

Let me know if it works.

We use the fontawesome 5.x so you may select the version and search for correct class from fontawesome website.

GHSix commented on Aug 18, 2022

Ha, so simple. It worked!

I had copied this sample from Docs and didn't noticed the icon difference.

Thank you.

GHSix commented on Aug 18, 2022

And how to use Dashboard AutoMaker within it?

I have tried:

'value' => \AutoMaker::rawSQL('SELECT SUM(income) income FROM table')

Gives error.

Also tried:

->dataSource(function() use ($dashboard) {
                return $dashboard->getSharedData()
                    ->run()
                    ->process(\koolreport\processes\Group::process([
                        'sum' => 'income',
                    ]));
            })

But don ´t know how to describe the field column I want.

KoolReport commented on Aug 18, 2022

You do:

'value' => \AutoMaker::rawSQL('SELECT SUM(income) income FROM table')->run()->getScalar()
GHSix commented on Aug 18, 2022

Nice! Thank you

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Dashboard