A free open source IT asset/license management system
Disable send email when it should not be modified
Marcus Moore48979ce17774
diff --git a/app/Http/Livewire/CategoryEditForm.php b/app/Http/Livewire/CategoryEditForm.phpindex e51130e6ab..695bc589ae 100644--- a/app/Http/Livewire/CategoryEditForm.php+++ b/app/Http/Livewire/CategoryEditForm.php@@ -30,8 +30,8 @@ class CategoryEditForm extends Componentpublic function updated($property, $value){- if (in_array($property, ['eulaText', 'useDefaultEula']) && ($this->eulaText || $this->useDefaultEula)) {- $this->sendCheckInEmail = (bool)$value;+ if (in_array($property, ['eulaText', 'useDefaultEula'])) {+ $this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula;}}@@ -53,4 +53,9 @@ class CategoryEditForm extends Component{return $this->useDefaultEula;}++ public function getSendCheckInEmailDisabledProperty()+ {+ return $this->eulaText || $this->useDefaultEula;+ }}diff --git a/resources/views/livewire/category-edit-form.blade.php b/resources/views/livewire/category-edit-form.blade.phpindex 10c33bde48..634b457116 100644--- a/resources/views/livewire/category-edit-form.blade.php+++ b/resources/views/livewire/category-edit-form.blade.php@@ -41,7 +41,7 @@<div class="form-group"><div class="col-md-9 col-md-offset-3"><label class="form-control">- {{ Form::checkbox('checkin_email', '1', null, ['wire:model' => 'sendCheckInEmail', 'aria-label'=>'checkin_email']) }}+ {{ Form::checkbox('checkin_email', '1', null, ['wire:model' => 'sendCheckInEmail', 'aria-label'=>'checkin_email', 'disabled' => $this->sendCheckInEmailDisabled]) }}{{ trans('admin/categories/general.checkin_email') }}</label>@if ($this->shouldDisplayEmailMessage)diff --git a/tests/Feature/Livewire/CategoryEditFormTest.php b/tests/Feature/Livewire/CategoryEditFormTest.phpindex 20399c6c60..f151a8f0be 100644--- a/tests/Feature/Livewire/CategoryEditFormTest.php+++ b/tests/Feature/Livewire/CategoryEditFormTest.php@@ -59,7 +59,7 @@ class CategoryEditFormTest extends TestCase->assertSet('sendCheckInEmail', true);}- public function testSendEmailCheckboxCheckedAndEulaTextDisabledWhenUseDefaultEulaSelected()+ public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected(){Livewire::test(CategoryEditForm::class, ['sendCheckInEmail' => false,@@ -67,6 +67,8 @@ class CategoryEditFormTest extends TestCase])->assertSet('sendCheckInEmail', false)->set('useDefaultEula', true)->assertSet('sendCheckInEmail', true)- ->assertSet('eulaTextDisabled', true);+ ->assertSet('eulaTextDisabled', true)+ ->assertSet('sendCheckInEmailDisabled', true);+ }}}