2023-08-01 17:29:23 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Livewire;
|
|
|
|
|
|
|
|
use Livewire\Component;
|
|
|
|
|
|
|
|
class CategoryEditForm extends Component
|
|
|
|
{
|
2023-08-02 12:58:07 -07:00
|
|
|
public $checkinEmail;
|
2023-08-01 17:29:23 -07:00
|
|
|
|
|
|
|
public $defaultEulaText;
|
|
|
|
|
|
|
|
public $eulaText;
|
|
|
|
|
2023-08-02 12:58:07 -07:00
|
|
|
public $requireAcceptance;
|
2023-08-01 17:29:23 -07:00
|
|
|
|
2023-08-02 12:58:07 -07:00
|
|
|
public $useDefaultEula;
|
2023-08-01 17:29:23 -07:00
|
|
|
|
|
|
|
public function mount()
|
|
|
|
{
|
2023-08-02 16:04:01 -07:00
|
|
|
if ($this->eulaText || $this->useDefaultEula) {
|
|
|
|
$this->checkinEmail = true;
|
|
|
|
}
|
2023-08-01 17:29:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
return view('livewire.category-edit-form');
|
|
|
|
}
|
|
|
|
|
2023-08-02 16:04:01 -07:00
|
|
|
public function updated($property, $value)
|
|
|
|
{
|
|
|
|
if (in_array($property, ['eulaText', 'useDefaultEula']) && ($this->eulaText || $this->useDefaultEula)) {
|
|
|
|
$this->checkinEmail = (bool)$value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-02 11:36:20 -07:00
|
|
|
public function getShouldDisplayEmailMessageProperty(): bool
|
2023-08-01 17:29:23 -07:00
|
|
|
{
|
2023-08-02 11:36:20 -07:00
|
|
|
return $this->eulaText || $this->useDefaultEula;
|
2023-08-01 17:29:23 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getEmailMessageProperty(): string
|
|
|
|
{
|
2023-08-02 11:36:20 -07:00
|
|
|
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');
|
2023-08-01 17:29:23 -07:00
|
|
|
}
|
|
|
|
}
|