aymanalhattami / filament-page-with-sidebar

Organize pages in the sidebar in order to make navigation between pages more comfortable.
https://github.com/aymanalhattami/filament-page-with-sidebar
MIT License
175 stars 22 forks source link

ViewRessource : Infolist & relation manager #16

Closed Thiktak closed 1 year ago

Thiktak commented 1 year ago

Hello,

I tested this package with a Filament V3, based on a ViewPage with Infolist. Unfortunately, no relation have been rendered (missing the Tab + content)

Created ressource + sidebar(), with following blade view:

<x-filament-page-with-sidebar::page>
    <x-filament::page>
        {{ $this->infolist }}
    </x-filament::page>
</x-filament-page-with-sidebar::page>

Also tested with <x-filament-panels::page>

When I check filament\resources\view\resources\pages\view-record, we are missing the relation managers panels ( -- and more stuff). image

Adding the missing part is rendering correctly the panel. But I guess some class & objects could still be missing ? image

Idea:

aymanalhattami commented 1 year ago

Adding the missing part is rendering correctly the panel

In view and edit page, If you want to show the relation managers and tabs, you need to copy the code form filament\resources\view\resources\pages\view-record and filament\resources\view\resources\pages\edit-record and paste it to your custom blade file.

Idea:

  • is it maybe possible to overwrite the layout instead of using a specific view ?
  • A dynamic call of the component that should have been called ?

Can you provide more details about your idea?

Thiktak commented 1 year ago

Yes, a copy of the code is a solution, but this means that if filament is updating something we will have to update evrything :(

Is it maybe possible to overwrite the layout instead of using a specific view ?

We have the possibility to overwrite the $view but also the $layout. Maybe we can find a way to use the $layout, with a custom one (with the sidebar) that will (automatically) surround the current component + call the previous layout defined ?

I tried some simple code, but nothing very interesting here for now.

A dynamic call of the component that should have been called ?

This idea is to call dyamically the correct [View/Edit/...]Record page with the $this context parameter. I found @livewire($componentName), <x-dynamic-component :component="$componentName" /> or even <livewire:is :component="$componentName" />

I tried some simple code, but nothing very interesting here for now.

Another idea (will test tonight), could be to call an @include of the corresponding view object (specified as constant or dynamically determined).

<x-filament-page-with-sidebar::page>
    @include($this->getChildComponentView())
</x-filament-page-with-sidebar::page>

And getChildComponentView could be a ReflectionClass::getDefaultProperties to get the parent default value's $view of the component.

Just some idea :)