nanopanda
Searchable MorphTo
Having a relation named 'model' seems like it might break something, or at the very least be confusing. I'm not sure on your specific error here, but you can pass a closure to searchable() and override the query to search specific columns of your MorphTo models.
5 replies
Grouping Rows with Closure/Tree relation
I'm not sure how getKeyFromRecordUsing functions internally, but based on your output it looks like it's still doing the actual group partitioning based on the "name" attribute of the product. I think you would need to make the attribute passed in to Group::make() an actual relation, like "parent.name" for the DB query to be output correctly.
6 replies
Full page loading
@Dennyvik Hmm, have you traced why the modal takes so long to display? I tested a similar column Action structure to your code above, without your $record logic. The modal works normally, and if I add some very slow filters to my table, then the spinner will show correctly before the modal is displayed. Did you add the RenderHook on PanelsRenderHook::FOOTER in your PanelProvider? Any custom theme styles that might conflict?
19 replies
Full page loading
@Xavi I just hacked up the markup from the example:
<div
x-cloak
x-show="$store.isLoading.value"
class="h-screen w-screen fixed bg-gray-950/50 left-1/2 -translate-x-1/2 z-[6000001]"
>
<div class="absolute top-1/2 -translate-y-3/4 left-1/2">
<h2 class="text-center text-gray-400 font-bold text-2xl">Loading...</h2>
<x-filament::loading-indicator
class="w-72 h-72 text-center"
/>
</div>
19 replies
table inside tabs its possible?
I may be wrong, but your top level tabs seem to more of a top Navigation? In that case you can use ->topNavigation() on your Filament PanelProvider to get a similar effect, although I think the default sidebar nav is more flexible and generally a better approach for a Filament app.
Also, while you can likely achieve something close to your screenshot by creating custom Pages and a blade template wrapper, it will probably take a lot more work to get there vs. leveraging the UX of Filament's built-in layout + components.
35 replies
Full page loading
@Xavi I recently implemented the example from Lara Zeus (many thx!!) and it works great. I set the timeout at 1500ms and changed the markup so that the spinner is center screen and masks the entire window from additional clicks.
19 replies
How to avoid showing all widgets on all dashboard pages?
@nowak FWIW, my app has a main dashboard and 4 additional dashboards grouped under an "Analytics" navigationGroup. The analytics dashboards have their own collections of widgets that have specific filter form criteria and are tailored to specifc types of data / Models. All you really need to do is override the getWidgets() method in your Dashboard classes to include only the widgets that you want. If you want Shield permssions for individual widgets ( not just the Dashboard pages ) then you'll still need to register all of them in your panel provider. I also have my Models ( and their Policies ) in sub-folders by functional area, with Resources and Widgets following the same structural pattern.
38 replies
SelectFilter doesn't working
The name passed to make() should be the column name. See below in the docs. Also, options() expects an array, so if you have an enum you may need a method to convert the cases like this:
public static function filterOptions(): array {
return array_column(self::cases(), "value", "name");
}
"Select filters do not require a custom query() method. The column name used to scope the query is the name of the filter. To customize this, you may use the attribute() method:"
6 replies
summarize calculated fields in footer
@ddoddsr In your case I think you are already storing the percentage of sample size ( Connect ) and Sample size ( Request ). So can change the Summarizer ->using() function to something like:
See here also: https://www.omnicalculator.com/math/average-percentage
14 replies
summarize calculated fields in footer
@ddoddsr gotcha, I'm not a math expert, but if you are using a Average Percentage formula like:
[(Percentage 1 + Percentage 2 ... + Percentage N) / (Sample size 1 + Sample size 2 ... + Sample size N )] x 100
Then I suppose you would need two virtual columns for storing the percentages and sample sizes. Then I think you could make your Summarizer ->using() function perform the final calculation like:
14 replies
summarize calculated fields in footer
You can't accomplish it that way. A custom Summarizer can modify the $query with an aggregate calculation function ( passed to DB ), but it can't perform in-memory calculations for each record. The calculated columns only work because they can run for only the visible records after the query is fetched.
14 replies