diff --git a/app/Http/Livewire/Admin/Menu/Level.php b/app/Http/Livewire/Admin/Menu/Level.php index bfcc53b..c0a429b 100644 --- a/app/Http/Livewire/Admin/Menu/Level.php +++ b/app/Http/Livewire/Admin/Menu/Level.php @@ -52,6 +52,7 @@ public function submit(){ $this->resetForm(); $this->resetInput(); $this->dispatchBrowserEvent('FirstModel',['show'=>false]); + $this->dispatchBrowserEvent('Toast',['show'=>true,'type'=>'success','message'=>"'".$level->name."'".' was added to Menu Level!']); } public function render() diff --git a/app/View/Components/Item/Toast.php b/app/View/Components/Item/Toast.php new file mode 100644 index 0000000..06d94a3 --- /dev/null +++ b/app/View/Components/Item/Toast.php @@ -0,0 +1,28 @@ +id(); - $table->timestamps(); $table->string('name'); + $table->timestamps(); }); } diff --git a/resources/js/components/main.js b/resources/js/components/main.js index 6f4e778..0157dd1 100644 --- a/resources/js/components/main.js +++ b/resources/js/components/main.js @@ -9,6 +9,7 @@ export function Main(data) { return { darkMode: data.darkMode, isSidebarOpen: false, + toast:{'show':false,'type':'normal','message':'Some message!'}, isFirstModelButtonClicked: false, init() { @@ -18,13 +19,33 @@ export function Main(data) { console.log(this.isFirstModelButtonClicked); }); }, + + toastNotification() { + if(this.toast.show === true){ + setTimeout(() => { + this.toast.show = false + }, 5000) + } + }, + eventToListen() { - console.log('hello'); + + // First Model window.addEventListener('FirstModel', event => { if (event.detail.show === false) { this.isFirstModelButtonClicked = false } }); + + // Toast + window.addEventListener('Toast', event => { + if (event.detail.show === true) { + this.toast.show=true + this.toast.type=event.detail.type; + this.toast.message=event.detail.message; + this.toastNotification(); + } + }); } } } diff --git a/resources/views/components/item/toast.blade.php b/resources/views/components/item/toast.blade.php new file mode 100644 index 0000000..32e188b --- /dev/null +++ b/resources/views/components/item/toast.blade.php @@ -0,0 +1,67 @@ + +
+ {{-- Normal Message --}} + + + {{-- Success Message --}} + + + {{-- Error Message --}} + + + {{-- Warning Message --}} + +
diff --git a/resources/views/components/svg/checked-circle.blade.php b/resources/views/components/svg/checked-circle.blade.php new file mode 100644 index 0000000..bb21a37 --- /dev/null +++ b/resources/views/components/svg/checked-circle.blade.php @@ -0,0 +1,5 @@ +merge(['class' => 'flex-none']) }} xmlns="http://www.w3.org/2000/svg" width="16" height="16" + fill="currentColor" viewBox="0 0 16 16"> + + diff --git a/resources/views/components/svg/cross-circle.blade.php b/resources/views/components/svg/cross-circle.blade.php new file mode 100644 index 0000000..c2c0bcd --- /dev/null +++ b/resources/views/components/svg/cross-circle.blade.php @@ -0,0 +1,5 @@ +merge(['class' => 'flex-none']) }} xmlns="http://www.w3.org/2000/svg" width="16" height="16" + fill="currentColor" viewBox="0 0 16 16"> + + diff --git a/resources/views/components/svg/exclamation-circle.blade.php b/resources/views/components/svg/exclamation-circle.blade.php new file mode 100644 index 0000000..52a63d4 --- /dev/null +++ b/resources/views/components/svg/exclamation-circle.blade.php @@ -0,0 +1,5 @@ +merge(['class' => 'flex-none']) }} xmlns="http://www.w3.org/2000/svg" width="16" + height="16" fill="currentColor" viewBox="0 0 16 16"> + + diff --git a/resources/views/components/svg/information.blade.php b/resources/views/components/svg/information.blade.php new file mode 100644 index 0000000..238eeda --- /dev/null +++ b/resources/views/components/svg/information.blade.php @@ -0,0 +1,5 @@ +merge(['class' => 'flex-none']) }} xmlns="http://www.w3.org/2000/svg" width="16" height="16" + fill="currentColor" viewBox="0 0 16 16"> + + diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 249a27f..8982cd2 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -25,13 +25,22 @@
{{$slot}} + +
@stack('modals') + + + + + + + @livewireScripts -
diff --git a/resources/views/livewire/admin/menu/level.blade.php b/resources/views/livewire/admin/menu/level.blade.php index c4ddadd..ee526be 100644 --- a/resources/views/livewire/admin/menu/level.blade.php +++ b/resources/views/livewire/admin/menu/level.blade.php @@ -6,7 +6,8 @@ - + +
@@ -15,5 +16,13 @@ + + + + + + + +