mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 14:27:33 -08:00
Disable send email when it should not be modified
This commit is contained in:
parent
e12935f7fa
commit
48979ce177
|
@ -30,8 +30,8 @@ class CategoryEditForm extends Component
|
||||||
|
|
||||||
public function updated($property, $value)
|
public function updated($property, $value)
|
||||||
{
|
{
|
||||||
if (in_array($property, ['eulaText', 'useDefaultEula']) && ($this->eulaText || $this->useDefaultEula)) {
|
if (in_array($property, ['eulaText', 'useDefaultEula'])) {
|
||||||
$this->sendCheckInEmail = (bool)$value;
|
$this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,4 +53,9 @@ class CategoryEditForm extends Component
|
||||||
{
|
{
|
||||||
return $this->useDefaultEula;
|
return $this->useDefaultEula;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSendCheckInEmailDisabledProperty()
|
||||||
|
{
|
||||||
|
return $this->eulaText || $this->useDefaultEula;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-9 col-md-offset-3">
|
<div class="col-md-9 col-md-offset-3">
|
||||||
<label class="form-control">
|
<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') }}
|
{{ trans('admin/categories/general.checkin_email') }}
|
||||||
</label>
|
</label>
|
||||||
@if ($this->shouldDisplayEmailMessage)
|
@if ($this->shouldDisplayEmailMessage)
|
||||||
|
|
|
@ -59,7 +59,7 @@ class CategoryEditFormTest extends TestCase
|
||||||
->assertSet('sendCheckInEmail', true);
|
->assertSet('sendCheckInEmail', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSendEmailCheckboxCheckedAndEulaTextDisabledWhenUseDefaultEulaSelected()
|
public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected()
|
||||||
{
|
{
|
||||||
Livewire::test(CategoryEditForm::class, [
|
Livewire::test(CategoryEditForm::class, [
|
||||||
'sendCheckInEmail' => false,
|
'sendCheckInEmail' => false,
|
||||||
|
@ -67,6 +67,8 @@ class CategoryEditFormTest extends TestCase
|
||||||
])->assertSet('sendCheckInEmail', false)
|
])->assertSet('sendCheckInEmail', false)
|
||||||
->set('useDefaultEula', true)
|
->set('useDefaultEula', true)
|
||||||
->assertSet('sendCheckInEmail', true)
|
->assertSet('sendCheckInEmail', true)
|
||||||
->assertSet('eulaTextDisabled', true);
|
->assertSet('eulaTextDisabled', true)
|
||||||
|
->assertSet('sendCheckInEmailDisabled', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue