David | Fortune Validator
David | Fortune Validator
FFilament
Created by David | Fortune Validator on 11/28/2024 in #❓┊help
Group Table By Year
Hi all I have an Invoice model and I want to show a table of profits per year. The column is 'date' and 'profit' so I need to YEAR(date) and SUM(profit). Ive had no end of trouble trying all sorts of methods. Does anyone know how to do this ?
3 replies
FFilament
Created by David | Fortune Validator on 11/27/2024 in #❓┊help
ModalContent() to load a livewire component directly
Hi all I am using a Modal to display a Filament table. I am having to load a view which then calls a livewire component. But it it possible to do something like this
->modalContent(fn (DocketPrices $record) => Blade::render('<livewire.dockets.supplier-orders.list-orders-wrapper :docket_price="$record" />'))
->modalContent(fn (DocketPrices $record) => Blade::render('<livewire.dockets.supplier-orders.list-orders-wrapper :docket_price="$record" />'))
and skip out the view which only exists to call the livewire component. I havnt managed to get this to work yet. Currently I need to do this:
->modalContent(fn (DocketPrices $record): View => view('livewire.dockets.supplier-orders.list-orders-wrapper', ['docket_price' => $record]))
->modalContent(fn (DocketPrices $record): View => view('livewire.dockets.supplier-orders.list-orders-wrapper', ['docket_price' => $record]))
which then calls
<livewire:dockets.supplier-orders.list-orders :docket-price="$docket_price" lazy="on-load" />
<livewire:dockets.supplier-orders.list-orders :docket-price="$docket_price" lazy="on-load" />
2 replies
FFilament
Created by David | Fortune Validator on 11/23/2024 in #❓┊help
Infolist data from Form textarea
Hey all I have some data saved using a Textarea with mulitple lines. Is there a standard practice way to get the line breaks to show when using TextEntry on an infolist? thank you
6 replies
FFilament
Created by David | Fortune Validator on 11/8/2024 in #❓┊help
Custom Pages By User
Hi all I need a little advice on the best approach. I have a Reporting page whereby I select a user and then I can multiple sub pages to view different types of data about said user. Currently I select a user and I get the URL
/rephub/dashboard?selectedUser=10
/rephub/dashboard?selectedUser=10
Then I navigate to a subpage and pass along the selectedUser
/rephub/forecast-turnover?selectedUser=10
/rephub/forecast-turnover?selectedUser=10
I am doing this simply by custom pages under a cluster called
I feel like this is not the best approach though. Something like
I feel like this is not the best approach though. Something like
/rephub/10/forecast-turnover``` would be more approporate but I'm not sure how to implement this. I thought the User resource but only an admin can see this. Other info: an admin can see all users in the rephub but a standard user can only see themselves. Any tips on the best way to manage this would be appreciated as I have multiple area of my system that generate reports and such. I could be overthinking this.
10 replies
FFilament
Created by David | Fortune Validator on 10/11/2024 in #❓┊help
SUB_NAVIGATION Hook
Hi all I am having trouble finding a hook that will let me display content underneath the Sub Navigation on a resource. I've tried all the hooks and the best I can find is PAGE_SUB_NAVIGATION_START_AFTER but that shows the content next to the sub navigation rather than under it. Sorry if I am missing it but any help would be appreciated. Thank you.
11 replies
FFilament
Created by David | Fortune Validator on 9/10/2024 in #❓┊help
Update Edit Modal on Table
No description
26 replies
FFilament
Created by David | Fortune Validator on 8/21/2024 in #❓┊help
Dynamic Badge Count on Sub Navigation Relation Page
Hi all I am not finding a method that I can use which I can access the the relationship modal on a relationship manager PAGE. I can edit the label of the sub navigation but I cannot seem to access the records to get a count. I simply would like a badge count on the sub nav. Can anyone assist here at all? Many thanks.
8 replies
FFilament
Created by David | Fortune Validator on 8/20/2024 in #❓┊help
Relationship Tabs on Mobile
Hi all I noticed if you have a sub page navigation as a top of the page tabs ( the same as the relationship manger tabs ), on a mobile when using Sub Nav it changes to a nice SELECT, but if you are standard relationship manager tabs they stay as tabs. Does anyone know a way to force a Select for mobile on this? It works much nicer when I have lots of relationship managers.
5 replies
FFilament
Created by David | Fortune Validator on 8/20/2024 in #❓┊help
Update Parent Form data after Relationship Manager update
Hi all I have an Edit page with a relationship manager table. I update an item on the table and I now want to update the parent form to reflect a new 'total' field. I have this so far:
$this->dispatch('DocketEdit.refreshAfterDocketPriceChange');
$this->dispatch('DocketEdit.refreshAfterDocketPriceChange');
#[On('DocketEdit.refreshAfterDocketPriceChange')]
public function refreshForm(): void
{
$this->refreshFormData(['total_estimate','total_cost']);
$this->save();
}
#[On('DocketEdit.refreshAfterDocketPriceChange')]
public function refreshForm(): void
{
$this->refreshFormData(['total_estimate','total_cost']);
$this->save();
}
It works but I get two Save notifcations.
$this->refreshFormData(['total_estimate','total_cost']);
$this->refreshFormData(['total_estimate','total_cost']);
works great but as I have the unsaved notifactions on if I try to navigate away it thinks there is unsaved data. So I added in the $this->save() Is this really the best way to update refresh the parent form? as currently Im updating the form twice. Once in an After() action on the table and again after the form has refreshed.
2 replies
FFilament
Created by David | Fortune Validator on 8/19/2024 in #❓┊help
Table -> Modal -> Filament Table
Hi all I've an interesting issue. I have a filament table with a custom action (opens a modal) on a row:
Tables\Actions\Action::make('Pallet Labels')
->modalContent(fn (DocketPrices $record): View => view('livewire.dockets.pallet-labels.list-pallet-labels-wrapper', ['docket_price' => $record]))
Tables\Actions\Action::make('Pallet Labels')
->modalContent(fn (DocketPrices $record): View => view('livewire.dockets.pallet-labels.list-pallet-labels-wrapper', ['docket_price' => $record]))
I have used ->modalContent to direct to a blade file which calls the livewire component
<livewire:dockets.pallet-labels.list-pallet-labels :docket-price="$docket_price" />
<livewire:dockets.pallet-labels.list-pallet-labels :docket-price="$docket_price" />
On the pallet lables modal, I have another livewire component which is utilising a Filament Table to display associated Pallet Labels. This is working to this point ( I assume this is the best method thus far? ) The issue I have: When I click 'Create Pallet Label' or the Edit button it SHOULD open a SECOND modal, however I get a js error
TypeError: Cannot read properties of undefined (reading 'dispatchEvent')
TypeError: Cannot read properties of undefined (reading 'dispatchEvent')
. If I click the button again it will then load modal and work as intended. I wondered if 1) I am doing this the correct way or 2) ideas on fixing the error so it doesnt require two clicks Thanks everyone.
3 replies
FFilament
Created by David | Fortune Validator on 8/16/2024 in #❓┊help
Is it possible to apply a class to a specific page? So I can target some css to only that page?
I am using panels and I have a relationshup manager table which I would like to apply some custom css to but I dont want to override every RM table on my app. I've tried to look through the source html and I cannot see any unique identifier for that page.
10 replies
FFilament
Created by David | Fortune Validator on 8/4/2024 in #❓┊help
Eager load or lazy load on modals?
Sorry for the silly question. I have an Edit modal for a record on my table. I am using $record->supplier in multiple places ( supplier being a relationship which gets the supplier modal for the table record ). Is a query being run each time to get the supplier info or is it eager loaded the once? Thanks all. I am running $record->supplier maybe five times through the schema so I idealy I didnt want to be running a query five times for the same thing. Example code usage:
TextInput::make('total')->prefix('£')->required()->numeric()
->live()->debounce()
->afterStateUpdated(fn (Set $set, Get $get, $state, $record) => self::totalsCalc($set, $get, $state, $record->supplier, 'total')),
TextInput::make('total')->prefix('£')->required()->numeric()
->live()->debounce()
->afterStateUpdated(fn (Set $set, Get $get, $state, $record) => self::totalsCalc($set, $get, $state, $record->supplier, 'total')),
5 replies
FFilament
Created by David | Fortune Validator on 7/22/2024 in #❓┊help
Repeater action -> modal
Hey all Feel like I live in this thread at the moment so I do apologise. I have the following: 1) Estimate Edit Page with a repeater showing EstimatePrices. It shows a slimed version. 2) I want an action on the repeater item to open up the estimatePrices record so I can perform further relationship components and show more fields. I cannot for the live of me figure out how to pass the repeater record model/collection in. To clarify I want the record of the repeater passed in and not the main parent record. Any help would be appreciated. Thank you.
35 replies
FFilament
Created by David | Fortune Validator on 7/21/2024 in #❓┊help
Get Repeater data for form save
hi all I have an Estimate Model and I'm using a form with a repeater to show all EstimateCosts records associated. I can view and save these no problem. However, I want to be able to access all the repeater records before saving. They dont appear in the $data var. My aim is to add all the 'price' fields from the repeater and save them to a field on the Estimate record. Any help would be greatly appreciated.
5 replies
FFilament
Created by David | Fortune Validator on 7/20/2024 in #❓┊help
unsavedChangesAlert() - can this work on non panel. eg a filament form on a livewire component ?
can this work on non panel. eg a filament form on a livewire component ? I’ve not worked out how if indeed it’s possible at all. Thanks everyone.
4 replies
FFilament
Created by David | Fortune Validator on 7/16/2024 in #❓┊help
recordUrl() to open Modal
Hi all Using a livewire component I want the row to open the View Action Model and not a page route. Is this possible? I struggled to get it to work, find in the docs.
18 replies
FFilament
Created by David | Fortune Validator on 7/14/2024 in #❓┊help
How to access Page key
Hi all Just a quick one hopefully. I have need to dynamically access to page key eg Create Edit List. I need to only allow a check on the default option for a select based off whether the $_GET parameter exists. But only want to do so on the Create form. Is there a quick one to check this ? Thanks all
8 replies
FFilament
Created by David | Fortune Validator on 7/12/2024 in #❓┊help
Embed Notification Action
I'm at a loss on this one. I have a notification that pops up and halts a Create form when no credit exists. I then have a button to request a credit limit. I cannot seem to fire off said custom action. for the moment I have a die() in place.
protected function beforeCreate(): void
{
$credit = new CreditLimitReport($this->data['client_id']);
if(!$credit->isLive)
{
Notification::make()
->warning()
->title('Credit not set')
->actions([
Action::make('request_credit')
->label('Request Credit')
->action(function(){
die('test');
}) ,
])
->send();
$this->halt();
}
}
protected function beforeCreate(): void
{
$credit = new CreditLimitReport($this->data['client_id']);
if(!$credit->isLive)
{
Notification::make()
->warning()
->title('Credit not set')
->actions([
Action::make('request_credit')
->label('Request Credit')
->action(function(){
die('test');
}) ,
])
->send();
$this->halt();
}
}
4 replies
FFilament
Created by David | Fortune Validator on 7/9/2024 in #❓┊help
Autofocus() on modals
Im seeing lots of posts about autofocus() not working on modals. I have now come across the issue myself, even on a simple form. The follow user has this solution: https://discord.com/channels/883083792112300104/1137977978677108816/1138339761522753536 The above works but I feel like perhaps another solution is needed?
2 replies
FFilament
Created by David | Fortune Validator on 7/9/2024 in #❓┊help
Missing JS on livewire component
Hi all I have a table and form with various actions on an existing project. It looks like the autosize on textareas is throwing an error. livewire.js?id=c4fc8c5d:1125 Alpine Expression Error: height is not defined and ReferenceError: resize is not defined I have included Filament with @filamentScripts in my main layout file. Any ideas? EDIT: I am seeing the same errors on the Panel side of the site as well :/
4 replies