diff --git a/app/View/Page/Modal.php b/app/View/Page/Modal.php new file mode 100644 index 00000000..072ff59f --- /dev/null +++ b/app/View/Page/Modal.php @@ -0,0 +1,101 @@ +component = $component; + $this->props = $props; + $this->size = $size; + $this->title = $title; + $this->key = md5(json_encode(['component' => $component, 'props' => $props])); + $this->actions = $this->parseActions($actions); + } + + public function parseActions(array $actions): array + { + return collect($actions)->map(function ($action) { + if ($action === 'closeable') { + return ['event' => 'closeModal', 'icon' => 'close', 'label' => 'Schließen']; + } + + if ($action === 'storeable') { + return ['event' => 'onStoreFromModal', 'icon' => 'save', 'label' => 'Speichern']; + } + + return $action; + })->toArray(); + } + + #[On('closeModal')] + public function onCloseModal(): void + { + $this->reset(); + } + + public function sizeClass(): string + { + if ($this->size === 'lg') { + return 'max-w-lg'; + } + + if ($this->size === 'xl') { + return 'max-w-xl'; + } + + return ''; + } + + public function render() + { + return <<<'HTML' +
+ @if($component) +
+
+
+

{{$title}}

+
+ @foreach ($this->actions as $action) + + + + @endforeach +
+
+
+
+ @if ($component) + @livewire($component, $props, key($key)) + @endif +
+
+
+
+ @else +
+ @endif +
+ HTML; + } +} diff --git a/resources/js/components/ui/Popup.vue b/resources/js/components/ui/Popup.vue deleted file mode 100644 index 0c84fa42..00000000 --- a/resources/js/components/ui/Popup.vue +++ /dev/null @@ -1,45 +0,0 @@ - - -