Implement toggling message when email will be sent

This commit is contained in:
Marcus Moore 2023-08-02 11:36:20 -07:00
parent 6349d52803
commit 105c94aea9
No known key found for this signature in database
2 changed files with 8 additions and 7 deletions

View file

@ -6,8 +6,6 @@ use Livewire\Component;
class CategoryEditForm extends Component
{
// public bool $displayEmailMessage = false;
public bool $checkinEmail;
public $defaultEulaText;
@ -33,14 +31,17 @@ class CategoryEditForm extends Component
return view('livewire.category-edit-form');
}
public function getDisplayEmailMessageProperty(): bool
public function getShouldDisplayEmailMessageProperty(): bool
{
return false;
return $this->eulaText || $this->useDefaultEula;
}
public function getEmailMessageProperty(): string
{
// @todo:
return '';
if ($this->useDefaultEula) {
return trans('admin/categories/general.email_will_be_sent_due_to_global_eula');
}
return trans('admin/categories/general.email_will_be_sent_due_to_category_eula');
}
}

View file

@ -44,7 +44,7 @@
{{ Form::checkbox('checkin_email', '1', null, ['wire:model' => 'checkinEmail', 'aria-label'=>'checkin_email']) }}
{{ trans('admin/categories/general.checkin_email') }}
</label>
@if ($this->displayEmailMessage)
@if ($this->shouldDisplayEmailMessage)
<div class="callout callout-info">
<i class="far fa-envelope"></i>
<span>{{ $this->emailMessage }}</span>