From 1a99817e488d622db8afe5150cb74776dc4a9acb Mon Sep 17 00:00:00 2001 From: Lasse Hassing Date: Tue, 8 Jun 2021 22:55:40 +0200 Subject: [PATCH] Close modals with escape or click outside box --- app/Http/Livewire/Actual.php | 6 ++++++ app/Http/Livewire/Projected.php | 7 +++++++ resources/views/livewire/actual.blade.php | 8 ++++---- resources/views/livewire/projected.blade.php | 13 ++++++------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/app/Http/Livewire/Actual.php b/app/Http/Livewire/Actual.php index b7f5ba6..8e70121 100644 --- a/app/Http/Livewire/Actual.php +++ b/app/Http/Livewire/Actual.php @@ -266,4 +266,10 @@ class Actual extends Component $this->switchDifferenceCSS = "bg-blue-700"; } } + + public function closeAllModals() { + $this->modalFieldUpdate = false; + $this->modalColumnUpdate = false; + $this->modalDelete = false; + } } diff --git a/app/Http/Livewire/Projected.php b/app/Http/Livewire/Projected.php index bada99f..7558efb 100644 --- a/app/Http/Livewire/Projected.php +++ b/app/Http/Livewire/Projected.php @@ -300,4 +300,11 @@ class Projected extends Component } $this->emitTo('actual', '$refresh'); } + + public function closeAllModals() { + $this->modalRowUpdate = false; + $this->modalFieldUpdate = false; + $this->modalColumnUpdate = false; + $this->modalDelete = false; + } } diff --git a/resources/views/livewire/actual.blade.php b/resources/views/livewire/actual.blade.php index cf57c20..76a7083 100644 --- a/resources/views/livewire/actual.blade.php +++ b/resources/views/livewire/actual.blade.php @@ -1,4 +1,4 @@ -
+
@if(\Auth::user()->hasPosts($year))
@@ -218,7 +218,7 @@