Return to specific panel TAB (Stack Laravel+Livewire+ PowerGrid)
Guys, sorry for the long text, but I'll try to detail my needs. I need help. I'm using Stack TALL + Powergrid.
What is the Scenario:
-
On the Blade there are 5 tabs where each one shows TABLES using PowerGrid.
-
Using the inline edit feature
What I want:
When the user edits inline, the page must refresh to summarize the WEIGHTS column and check if it is different from 100 and must return to the TAB in which the inline edit was made
Question:
Everything is working perfectly, I just can't return to the TAB that the user made the inline edit. As I use Powergrid and Livewire I am having difficulty understanding the passage of parameters.
As it is on Blade:
Here I pass the parameters I need to the PowerGrid component
<div>
<livewire:admin.setups.setup-tetrazolio-table setup_id="{{$setup_id}}" step="1" tab="1"/>
</div>
In PowerGrid, I force refresh:
#[On('onUpdatedEditable')]
public function onUpdatedEditable(string|int $id, string $field, string $value): void
{
$this->validate();
SetupTetrazolio::query()->find($id)->update([
$field => e($value),
]);
$this->dispatch('refresh-page');
}
When return to the blade, there is a script listening for 'refresh-page' and it refreshes:
window.addEventListener('refresh-page', event => {
window.location.reload(false);
})
When refreshing, the page must read Livewire's public function mount(). But I need to know which tab I'm in to be able to assign the value to a public $tab and be able to validate it in Blade as follows:
<li class="me-2" role="presentation">
<button class="inline-block p-4 border-b-2 rounded-t-lg" id="step1-styled-tab" data-tabs-target="#step1" type="button" role="tab" aria-controls="step1" aria-selected="{{ ($tab === 1 ? 'true' : 'false') }}">1. PRÉ-COLHEITA</button>
</li>
Please or to participate in this conversation.