epertinez
demo.filamentphp.com and https://shop.filamentphp.com/
Hi everybody,
I have a couple of quite large projects made in filament php, and I absolutely love it, so I am planning to offer a project to a customer of a shop online based on filament php.
Now, demo.filamentphp.com has the source code available, so I might start the project's backoffice installing and tweaking demo, instead of having to create Products, categories and orders myself.
Now... the point is that demo.filamentphp.com is a backoffice, but I don't know if there is a parallel frontoffice to start with. I see https://shop.filamentphp.com/ is made with shopify, so it is not a frontoffice for demo.filamentphp.com.
Does anybody know if there is a backoffice/frontoffice open (free or paid) project based on filamentphp (the backoffice) to work with? Any other working idea made with laravel? Thanks!
3 replies
actions AND header widget in EditPage not working in v3
Hi,
I have a quite normal Resource witch Edit page has some stand Action that opens a modal form. Everything works ok. Now, I want to add up a header widget that shows revellant info in the same Resource Edit page. When I activate the widget, the action buttons stop working. They gray out the page (to open the modal page) but then nothing is shown in the form. I tried with standard Table Widget and with my own and did not work.
I guess:
a) Form actions are routed to widget livewire instead of the form livewire?
or
b) The wigdet rendering (which renders AFTER form action buttons) is not playing nice with what filament form expects.
In this sense... I tried to avoid a) by showing the data, not as a widget, but as a hook in 'panels::page.header-widgets.before'. So no widget livewire messing up. Yet in this way action buttons do not work neither.
5 replies
modalHidden() something is wrong?
Hi,
A customer of mine has hundreds of fields on the same record/model/resource. Only ten of them are required. He receives the records partially filled from a web form. So fields are not really required, only logically required.
The fact is that they would like to be able to save the record, even with empty "required" fields and only check if some are missing when calling some action with the record.
I know how to "fake" the requireness of the fields with some extraAttributes class and some css. That is not a problem. The problem is that I need the Action to test if something is missing BEFORE actually acting, and showing a modal with info of what is missing... or simply act if nothing is missing.
I thought the modalHidden() function was my friend on that, but I might not understand how it works, because it don't do what I mean to:
Action::make('doSomethig')
->modalHidden( fn (Component $livewire):bool => $livewire->noRequiredFieldsMissing())
->modalContent(view('filament.view.showrequiredfieldsmissing'))
->action('doSomething')
As I understand from info, modal should only appear if modalHidden is false, and if it is not it should fall back to action.
But if I add an action() to the Action description it always calls to the action, regardless of what modalHidden is saying.
Could anybody give me a clue on what to look for? I am out of clues. Maybe there is another way to check if some condition is or is not meet before actually executing the action? Is there a way to create a modal from within a component action function? I could test if all required data is filled before executing the action, but someway I should be able to send a Modal to the browser if something is missing. A notification is not big enough in this case.
5 replies
EditPost force redirect to ViewPost if Post has given condition
Hi, I have some model that has a "closed" condition. Once the Model is closed, it cannot be edited anymore and therefore EditPost shouldn't be accesible.
The decision must be made regarding the state of the post, not the user, so I wanted to create a redirection if someone go to the post and it is "closed".
I tried all kind of hooks, but did not find the solution. I tried to overwrite mount() for example, but it returns nothing, so I don't know how to rise a redirect condition from there. I tried getRedirectUrl from EditRecord class, but this is only to redirect AFTER the record has been saved. I tried to overwrite the render() function...
public function render(): View
{ if ($this->record->isBlocked()) return redirect()->route('filament.app.resources.post.view', ['record' => $this->record]);
return parent::render();
}
but it tells me
Return value must be of type Illuminate\Contracts\View\View, Livewire\Features\SupportRedirects\Redirector returned
I cannot believe one cannot "secure" the edit url redirecting to view if conditions are not met, so I guess I am doing something wrong.
Can anybody help me? Is there a way in Route or Middleware to work with the resource and redirect? Any way to correctly convert a redirect() to a View?
Please, help.
6 replies
Radical lazy/defer load on collapsible column.
I have been 3 days trying to solve this and I couldn't found any way. Maybe is very simple.
I have a Table inside a Widget. That table has some visible rows and for each row one collapsible Panel/View/CustomColumn (whatever, I tried them all, don't really mind).
Now, the collapsible row shows a VERY EXPENSIVE GRAPH. So expensive that I don't want that graph to be prefetched, and I don't mind if the user needs to wait some seconds before getting it.
Don't want the system to ask for 30 of those graphs to the server just in case some user decides to look at one of them.
Now... with old school jquery/javascript I could create unique id's for recepting divs and make show buttons call some DOM modifier that asked the server for the graph data and then showed it into the div's location.
...but... with livewire... I have no control.
Things I tried:
I tried to find a way to get the info of Alpine.js isCollapsed variable into my CustomColumn extends Colum or into the blade view.... If I know if the given row element is collapsed, I might be able to return a very different thing.
Couldn't find a way to read Apline.js status from CustomColumn. Entangled did not work OR works with another object (maybe the widget) not with the column object.
Couldn't find a way to pass this isCollapsed variable value by any other way or using javascript or anyway. I see there are some ways to pass livewire vars to alpine.js, but I see no way to get that isCollapsible (or maybe a way to know if the dom subtree is hidden?)
Couldn't find a proper way to do a real lazy/defer method so I only get the Column when It ends being hidden in the dom. wire:init="loadData" do not work, first because it is not the Column method that is called, but the Widget method. Don't know how to inform the column method from the widget one.
3 replies
Admin resource: Selectable table row text
Hi,
A customer of me needs the table list text to be "selectable", that is, he needs to be able to copy paste the text.
Right now every row of the table has a click event (cool) to edit, and it seems like every column of the row is "dragable" so you can move the text as a whole, but you can not select a part of it.
Does it make sense?
How could i deactivate this "dragable" behaviour of those columns I want to?
3 replies