Add template save event handling and update preview functionality: Implemented afterSave method in Footer, Header, Menu, and Section templates to dispatch a 'template-saved' event for Livewire. Updated template preview components to listen for this event, ensuring previews are refreshed after template modifications. Enhanced viewData method in template forms for better record ID handling.
This commit is contained in:
@@ -46,13 +46,11 @@ class MenuTemplateForm
|
||||
|
||||
// Preview Component
|
||||
View::make('components.menu-template-preview')
|
||||
->viewData(function ($record) {
|
||||
return [
|
||||
'type' => 'menu',
|
||||
'fieldName' => 'html_content',
|
||||
'recordId' => $record?->id,
|
||||
];
|
||||
})
|
||||
->viewData([
|
||||
'type' => 'menu',
|
||||
'fieldName' => 'html_content',
|
||||
'recordId' => null, // Will be extracted from URL by JavaScript
|
||||
])
|
||||
->columnSpanFull(),
|
||||
|
||||
Toggle::make('is_active')
|
||||
|
||||
Reference in New Issue
Block a user