mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue