Display Module 13-05-2026
This commit is contained in:
parent
6a65354f4c
commit
9262132325
41 changed files with 496 additions and 334 deletions
|
|
@ -44,7 +44,7 @@ class DisplayList extends Component
|
|||
], true) ? $playlistStatus : DisplayPlaylist::STATUS_PUBLISHED;
|
||||
|
||||
if ($id) {
|
||||
$display = Display::with(['livePlaylist.modules', 'draftPlaylist.modules', 'versions'])->findOrFail($id);
|
||||
$display = Display::with(['livePlaylist.modules', 'draftPlaylist.modules'])->findOrFail($id);
|
||||
$this->displayId = $display->id;
|
||||
$this->displayName = $display->name;
|
||||
$this->displayLocation = $display->location ?? '';
|
||||
|
|
@ -137,7 +137,6 @@ class DisplayList extends Component
|
|||
$this->previewFrameRefreshCounter++;
|
||||
} else {
|
||||
$this->syncPublishedPlaylist($display);
|
||||
$this->syncLegacyPivot($display, $this->selectedVersionIds);
|
||||
}
|
||||
|
||||
$this->closeModal();
|
||||
|
|
@ -202,24 +201,9 @@ class DisplayList extends Component
|
|||
return $display->draftPlaylist->fresh('modules');
|
||||
});
|
||||
|
||||
$this->syncLegacyPivot($display, $this->moduleIdsForPlaylist($publishedPlaylist));
|
||||
|
||||
session()->flash('success', 'Entwurf wurde veröffentlicht.');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int> $versionIds
|
||||
*/
|
||||
private function syncLegacyPivot(Display $display, array $versionIds): void
|
||||
{
|
||||
$syncData = [];
|
||||
foreach ($versionIds as $sortOrder => $versionId) {
|
||||
$syncData[$versionId] = ['sort_order' => $sortOrder];
|
||||
}
|
||||
|
||||
$display->versions()->sync($syncData);
|
||||
}
|
||||
|
||||
private function syncPublishedPlaylist(Display $display): void
|
||||
{
|
||||
$playlist = $display->playlists()->firstOrCreate(
|
||||
|
|
@ -297,8 +281,7 @@ class DisplayList extends Component
|
|||
return $this->moduleIdsForPlaylist($display->draftPlaylist);
|
||||
}
|
||||
|
||||
return $this->moduleIdsForPlaylist($display->livePlaylist)
|
||||
?: $display->versions->pluck('id')->all();
|
||||
return $this->moduleIdsForPlaylist($display->livePlaylist);
|
||||
}
|
||||
|
||||
public function deleteDisplay(int $id): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue