Emaz
Emaz
FFilament
Created by Emaz on 6/21/2024 in #❓┊help
Fields being cleared out due to $set call on other fields
This is a bit hard to explain. I have a repeater with two fields, height and width. The repeater is live as are the 2 TextInputs. Then I have a placeholder which does a bunch of calculations. Placeholder::make('') ->content(function ($get, $set) { $total = static::newCalcTotal($set, $get); return new HtmlString("<p></p><br><h1><b>TOTAL $ $total</b></h1>"); }) newCalcTotal does a bunch of gets, calculates a total for an estimate and sets a few variables. @Dan Harrin gave me some brilliant guidance on this, doing all the calculations in one place and it's working great. Except for this weird issue. It does NOT touch the height and width fields. Yet clearly, after the calculation, often times the field that has focus (height or width) gets reset to the previous value after the calculation is complete. I validated this by removing the newCalcTotal method call and the problem goes away. One more debug point, which is weird, if I remove the set calls within newCalcTotal the problem also goes away. The $sets I use are unrelated to height/width: $set('calculations', $calcString); $set('grandTotal', sprintf("%01.2f", $grand )); $set('glass_total', $glassTotal); $set('hardware_total', $hwTotal); $set('labor_total', $laborTotal); $set('energy_total', $energy); $set('tax_amount', $tax); $set('grand_total', $grand); I need these sets as they are the result of all the calculations and are stored as part of the record. But if I comment out these $sets, the problem goes away. I've NO idea how to debug this. It's clearly related to $set although I am NOT setting height or width.
47 replies
FFilament
Created by Emaz on 6/5/2024 in #❓┊help
Setting/getting nested data form wide
No description
13 replies
FFilament
Created by Emaz on 5/2/2024 in #❓┊help
Custom blade view during create
Is it possible to display a blade view with record data during create? I've seen the docs for custom layouts https://filamentphp.com/docs/3.x/forms/layout/custom#view-components But using getRecord it's obviously null during create - might be useful for edit. My use case is a complex form to create an invoice. I'd like to use 1/2 of the view for the form fields and 1/2 using the View component to show a blade layout as you go. Is this possible? I've seen https://github.com/andrewdwallo/erpsaas which gives SOME clues but it's pretty hard to understand.
7 replies
FFilament
Created by Emaz on 4/9/2024 in #❓┊help
Custom Repeater button
No description
5 replies
FFilament
Created by Emaz on 4/4/2024 in #❓┊help
Any cool plugins to handle display of multiple uploads?
No description
11 replies
FFilament
Created by Emaz on 4/4/2024 in #❓┊help
Multiple levels of relationships and chatGPT
No description
4 replies
FFilament
Created by Emaz on 2/26/2024 in #❓┊help
Dot notation in form edit
I know this should be easy. I use dot notation in my table. Property model has a serivce_id and service model has a price. So in my property resource I use service.price no problem. In my form I want this to be a computed property. The default will be the same service.price but that just leaves the field blank. I thought I'd compute with pricing add ons after that but I can't get that initial field to fill. I thought I could do: Forms\Components\TextInput::make('service.price') ->disabled() ->dehydrated(false), But it just remains blank.
5 replies
FFilament
Created by Emaz on 12/5/2023 in #❓┊help
Notifications or Flash?
So what's the right way to do this? On a Table I have an action that takes me to a controller. I do a thing, and on success I return to the table. session()->flash('success', 'Estimate was sent successfully.'); return redirect('dash/estimates'); The flash doesn't seem to be flashing. Does Filament have the necessary flash code built in to its view? Or do I need to set that up?
5 replies
FFilament
Created by Emaz on 11/25/2023 in #❓┊help
Weekly Zoom / X spaces?
Sorry admins if this isn't allowed, I wanted to post it somewhere it might be seen. Happy to re-post elsewhere if needed. Is anyone interested in a weekly zoom? More and more I find myself doing entire projects based around Filament. And although this community is great I often find myself stuck sometimes, wondering how to do a feature outside of the great examples in the docs. Oftentimes these features are NOT strictly Filament - it might require some Livewire or JS outside of Filament and there might be a million ways to do what I want but I feel stuck. Some of you pros have the answers. And while I don't expect you to do the work for me, your guidance and brainstorming is invaluable. All I need is one point in the right direction and I can figure out the rest. I'm kind of mid range now in my experience and could occasionally help out beginners and I'm glad to do so. But we'd need a variety of skills to make this interesting as sometimes the solution lies in Laravel, Livewire, Alpine, etc. If this was of interest I'd be happy to host a Zoom and/or X spaces. You pros have no idea how much your guidance helps. I've been stuck on an issue before and luckily had Dan point me in the right direction with 2 sentences that completely unroadblocked me. Sometimes that's all it takes. I don't think Discord is the place because sometimes it requires a bit of discussion and even screensharing. Is there any interest? Could I get some of you Ninjas involved? And yeah I'm stuck on something right now - Using this great plug-in but trying to get it to do something it's not meant to do LOL https://filamentphp.com/plugins/saade-fullcalendar
5 replies
FFilament
Created by Emaz on 11/10/2023 in #❓┊help
SIGH... Hidden Nav item ?
I hate asking this but you all can save me loads of time and it might help someone else as well. I implemented a category on the Nav bar that I want hidden unless you're an admin (I'm hiding the User model). It's totally working as expected but I cannot find where I implemented it. Now that you're done laughing, what are the possibilities? LOL. Isn't the usual way to use hidden() or visible() like here: https://filamentphp.com/docs/3.x/panels/navigation#conditionally-hiding-navigation-items I am using that in other V3 Filament projects and I expected to find that here too (multitasking too much). But nope, I'm not doing that so what else can it be?
5 replies
FFilament
Created by Emaz on 10/28/2023 in #❓┊help
Repeater basics
No description
4 replies
FFilament
Created by Emaz on 10/18/2023 in #❓┊help
Encryption of text data
I'd like to do encryption/decryption of text data in a mutator. Is that going to impact places where I allow filtering and searching? That would depend on how Filament handles search/filter. If it's a normal Eloquent query this might be a no-go. On the other hand, if it's loading data in a way that goes through the mutator I'd be OK. Anyone know?
11 replies
FFilament
Created by Emaz on 10/16/2023 in #❓┊help
Hydration on Select
Can anyone think of a reason why my Select would not hydrate on edit? Select::make('priority') ->options([ '1' => '1. Urgent', '2' => '2. Easy', '3' => '3. Short Term', '4' => '4. Long Term', ]) ->afterStateHydrated(function ($state, Forms\Set $set, Forms\Get $get) { \Log::info($state); }), My ToDo model does have a mutator but I made sure the Select options match. public function getPriorityAttribute($value) { $options = [ '1' => '1. Urgent', '2' => '2. Easy', '3' => '3. Short Term', '4' => '4. Long Term', ]; return $options[$value] ?? $value; } Everything is working fine, just that when editing a record the Select doesn't hydrate so it says "Please select an option" instead of whatever data has been saved.
4 replies
FFilament
Created by Emaz on 10/15/2023 in #❓┊help
Disable edit on row
I know this is possible, I once saw it in the docs but I cannot find it. How can I disable the default behavior that makes clicking on the entire row go to the edit route?
7 replies
FFilament
Created by Emaz on 10/15/2023 in #❓┊help
Bug on bulk select for groups?
Should the checkbox for bulk select on a group header select everything in the group? In this example I have 2 items under Urgent and the checkboxes and selecting is all funky.
3 replies
FFilament
Created by Emaz on 10/14/2023 in #❓┊help
extraAttributes on Groups
No description
8 replies
FFilament
Created by Emaz on 10/13/2023 in #❓┊help
Is recordClasses working in V3?
No description
31 replies
FFilament
Created by Emaz on 10/12/2023 in #❓┊help
Custom field Alpine question
I'm working on a custom field. Dan's video was instrumental in getting me started. https://laracasts.com/series/build-advanced-components-for-filament/episodes/6 But I don't know how to load the store data in Alpine. Do I just set it in x-init from the state variable? That was the implication from the video but it's not working for me.... might be my version of Livewire though. I had some difficulty on the Filament V2 to V3 upgrade and had to manually get my composer.json together. How is it supposed to work? Just set it in x-init from state?
2 replies
FFilament
Created by Emaz on 10/11/2023 in #❓┊help
timer plugin?
Anyone know of a timer plugin? I don't see any. I wish I had the time to do one but I probably don't. But what do you all think would be involved? I'd like to see models that have a cumulative_time field. Then in filament, 3 buttons: start timer, end timer and a save button. So start/end would accumulate time. When you finally hit save, it saves the data to the model. Or a simpler version - press start, then when you press end the time is saved. If this is easier than I think maybe I'd tackle it. But I'm not sure how this would be done.
14 replies
FFilament
Created by Emaz on 10/8/2023 in #❓┊help
query override
No description
8 replies