From 23838959cac09a62ee0e45b05cf5b1d3a30fc75b Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:27:12 -0700 Subject: [PATCH 01/10] Never disable email checkbox --- app/Livewire/CategoryEditForm.php | 5 ----- resources/views/livewire/category-edit-form.blade.php | 4 ---- 2 files changed, 9 deletions(-) diff --git a/app/Livewire/CategoryEditForm.php b/app/Livewire/CategoryEditForm.php index 98e505c8df..10c8621509 100644 --- a/app/Livewire/CategoryEditForm.php +++ b/app/Livewire/CategoryEditForm.php @@ -61,9 +61,4 @@ class CategoryEditForm extends Component { return (bool)$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.php index aee6fe63ed..952e9c3b57 100644 --- a/resources/views/livewire/category-edit-form.blade.php +++ b/resources/views/livewire/category-edit-form.blade.php @@ -90,7 +90,6 @@ value="1" wire:model.live="sendCheckInEmail" aria-label="checkin_email" - @disabled($this->sendCheckInEmailDisabled) /> {{ trans('admin/categories/general.checkin_email') }} @@ -100,9 +99,6 @@ {{ $this->emailMessage }} @endif - @if ($this->sendCheckInEmailDisabled) - - @endif From df53d5d966f8f0ef25e256ff06b87b45c2ee0e97 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:32:01 -0700 Subject: [PATCH 02/10] Skip computing sendCheckInEmail --- app/Livewire/CategoryEditForm.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/app/Livewire/CategoryEditForm.php b/app/Livewire/CategoryEditForm.php index 10c8621509..4ac12efe79 100644 --- a/app/Livewire/CategoryEditForm.php +++ b/app/Livewire/CategoryEditForm.php @@ -12,37 +12,17 @@ class CategoryEditForm extends Component public $eulaText; - public $originalSendCheckInEmailValue; - public bool $requireAcceptance; public bool $sendCheckInEmail; public bool $useDefaultEula; - public function mount() - { - $this->originalSendCheckInEmailValue = $this->sendCheckInEmail; - - if ($this->eulaText || $this->useDefaultEula) { - $this->sendCheckInEmail = 1; - } - } - public function render() { return view('livewire.category-edit-form'); } - public function updated($property, $value) - { - if (! in_array($property, ['eulaText', 'useDefaultEula'])) { - return; - } - - $this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue; - } - public function getShouldDisplayEmailMessageProperty(): bool { return $this->eulaText || $this->useDefaultEula; From 2e8572d9c5b0e74eaa8665fe712b36b3c5e4d6bc Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:35:30 -0700 Subject: [PATCH 03/10] Use v3 syntax for computed properties --- app/Livewire/CategoryEditForm.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/Livewire/CategoryEditForm.php b/app/Livewire/CategoryEditForm.php index 4ac12efe79..8bd3cf8033 100644 --- a/app/Livewire/CategoryEditForm.php +++ b/app/Livewire/CategoryEditForm.php @@ -2,6 +2,7 @@ namespace App\Livewire; +use Livewire\Attributes\Computed; use Livewire\Component; class CategoryEditForm extends Component @@ -23,12 +24,14 @@ class CategoryEditForm extends Component return view('livewire.category-edit-form'); } - public function getShouldDisplayEmailMessageProperty(): bool + #[Computed] + public function shouldDisplayEmailMessage(): bool { return $this->eulaText || $this->useDefaultEula; } - public function getEmailMessageProperty(): string + #[Computed] + public function emailMessage(): string { if ($this->useDefaultEula) { return trans('admin/categories/general.email_will_be_sent_due_to_global_eula'); @@ -37,7 +40,8 @@ class CategoryEditForm extends Component return trans('admin/categories/general.email_will_be_sent_due_to_category_eula'); } - public function getEulaTextDisabledProperty() + #[Computed] + public function eulaTextDisabled() { return (bool)$this->useDefaultEula; } From 0f84d51a48e517c7f68f66c8bddcbd2aeedb06c5 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:37:17 -0700 Subject: [PATCH 04/10] Improve property name --- app/Livewire/CategoryEditForm.php | 2 +- resources/views/livewire/category-edit-form.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Livewire/CategoryEditForm.php b/app/Livewire/CategoryEditForm.php index 8bd3cf8033..6f5a42b9b2 100644 --- a/app/Livewire/CategoryEditForm.php +++ b/app/Livewire/CategoryEditForm.php @@ -25,7 +25,7 @@ class CategoryEditForm extends Component } #[Computed] - public function shouldDisplayEmailMessage(): bool + public function emailWillBeSendDueToEula(): bool { return $this->eulaText || $this->useDefaultEula; } diff --git a/resources/views/livewire/category-edit-form.blade.php b/resources/views/livewire/category-edit-form.blade.php index 952e9c3b57..4ceb6f6487 100644 --- a/resources/views/livewire/category-edit-form.blade.php +++ b/resources/views/livewire/category-edit-form.blade.php @@ -93,7 +93,7 @@ /> {{ trans('admin/categories/general.checkin_email') }} - @if ($this->shouldDisplayEmailMessage) + @if ($this->emailWillBeSendDueToEula)
{{ $this->emailMessage }} From 3bad19fb56e9d3fe8c1f50b376f3ca9778f62ea4 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:40:39 -0700 Subject: [PATCH 05/10] Improve translation key name --- resources/lang/en-US/admin/categories/general.php | 2 +- resources/views/livewire/category-edit-form.blade.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/en-US/admin/categories/general.php b/resources/lang/en-US/admin/categories/general.php index 4d036996ac..2ea61af5e0 100644 --- a/resources/lang/en-US/admin/categories/general.php +++ b/resources/lang/en-US/admin/categories/general.php @@ -3,7 +3,7 @@ return array( 'asset_categories' => 'Asset Categories', 'category_name' => 'Category Name', - 'checkin_email' => 'Send email to user on checkin/checkout.', + 'email_to_user_upon_checkin_and_checkout' => 'Send email to user on checkin/checkout.', 'email_to_initiator' => 'Send email to you when user accepts or declines checkout.', 'checkin_email_notification' => 'This user will be sent an email on checkin/checkout.', 'clone' => 'Clone Category', diff --git a/resources/views/livewire/category-edit-form.blade.php b/resources/views/livewire/category-edit-form.blade.php index 4ceb6f6487..57c3e858f5 100644 --- a/resources/views/livewire/category-edit-form.blade.php +++ b/resources/views/livewire/category-edit-form.blade.php @@ -91,7 +91,7 @@ wire:model.live="sendCheckInEmail" aria-label="checkin_email" /> - {{ trans('admin/categories/general.checkin_email') }} + {{ trans('admin/categories/general.email_to_user_upon_checkin_and_checkout') }} @if ($this->emailWillBeSendDueToEula)
From 0355c2b642c322ea6a26da64e15f2d654eb18ad8 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:44:34 -0700 Subject: [PATCH 06/10] Dynamically adjust checkbox wording --- resources/lang/en-US/admin/categories/general.php | 1 + resources/views/livewire/category-edit-form.blade.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/resources/lang/en-US/admin/categories/general.php b/resources/lang/en-US/admin/categories/general.php index 2ea61af5e0..333c0f118a 100644 --- a/resources/lang/en-US/admin/categories/general.php +++ b/resources/lang/en-US/admin/categories/general.php @@ -3,6 +3,7 @@ return array( 'asset_categories' => 'Asset Categories', 'category_name' => 'Category Name', + 'email_to_user_upon_checkin' => 'Send email to user on checkin.', 'email_to_user_upon_checkin_and_checkout' => 'Send email to user on checkin/checkout.', 'email_to_initiator' => 'Send email to you when user accepts or declines checkout.', 'checkin_email_notification' => 'This user will be sent an email on checkin/checkout.', diff --git a/resources/views/livewire/category-edit-form.blade.php b/resources/views/livewire/category-edit-form.blade.php index 57c3e858f5..105685b3d3 100644 --- a/resources/views/livewire/category-edit-form.blade.php +++ b/resources/views/livewire/category-edit-form.blade.php @@ -91,7 +91,11 @@ wire:model.live="sendCheckInEmail" aria-label="checkin_email" /> - {{ trans('admin/categories/general.email_to_user_upon_checkin_and_checkout') }} + @if ($this->emailWillBeSendDueToEula) + {{ trans('admin/categories/general.email_to_user_upon_checkin') }} + @else + {{ trans('admin/categories/general.email_to_user_upon_checkin_and_checkout') }} + @endif @if ($this->emailWillBeSendDueToEula)
From 2b27b733e5ed5692c1da4bebe3e8cfafc4e0326b Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:45:45 -0700 Subject: [PATCH 07/10] Improve wording --- resources/lang/en-US/admin/categories/general.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/lang/en-US/admin/categories/general.php b/resources/lang/en-US/admin/categories/general.php index 333c0f118a..0531fbfdbe 100644 --- a/resources/lang/en-US/admin/categories/general.php +++ b/resources/lang/en-US/admin/categories/general.php @@ -10,8 +10,8 @@ return array( 'clone' => 'Clone Category', 'create' => 'Create Category', 'edit' => 'Edit Category', - 'email_will_be_sent_due_to_global_eula' => 'An email will be sent to the user because the global EULA is being used.', - 'email_will_be_sent_due_to_category_eula' => 'An email will be sent to the user because a EULA is set for this category.', + 'email_will_be_sent_due_to_global_eula' => 'An email will be sent to the user on checkout because the global EULA is being used.', + 'email_will_be_sent_due_to_category_eula' => 'An email will be sent to the user on checkout because a EULA is set for this category.', 'eula_text' => 'Category EULA', 'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.', 'name' => 'Category Name', From 070e0c93be4856d08e61024a3e373e6211bec0ff Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 12:46:26 -0700 Subject: [PATCH 08/10] Improve phrasing --- resources/lang/en-US/admin/categories/general.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/lang/en-US/admin/categories/general.php b/resources/lang/en-US/admin/categories/general.php index 0531fbfdbe..838b4abb66 100644 --- a/resources/lang/en-US/admin/categories/general.php +++ b/resources/lang/en-US/admin/categories/general.php @@ -4,14 +4,14 @@ return array( 'asset_categories' => 'Asset Categories', 'category_name' => 'Category Name', 'email_to_user_upon_checkin' => 'Send email to user on checkin.', - 'email_to_user_upon_checkin_and_checkout' => 'Send email to user on checkin/checkout.', + 'email_to_user_upon_checkin_and_checkout' => 'Send email to user upon checkin/checkout.', 'email_to_initiator' => 'Send email to you when user accepts or declines checkout.', 'checkin_email_notification' => 'This user will be sent an email on checkin/checkout.', 'clone' => 'Clone Category', 'create' => 'Create Category', 'edit' => 'Edit Category', - 'email_will_be_sent_due_to_global_eula' => 'An email will be sent to the user on checkout because the global EULA is being used.', - 'email_will_be_sent_due_to_category_eula' => 'An email will be sent to the user on checkout because a EULA is set for this category.', + 'email_will_be_sent_due_to_global_eula' => 'An email will be sent to the user upon checkout because the global EULA is being used.', + 'email_will_be_sent_due_to_category_eula' => 'An email will be sent to the user upon checkout because a EULA is set for this category.', 'eula_text' => 'Category EULA', 'eula_text_help' => 'This field allows you to customize your EULAs for specific types of assets. If you only have one EULA for all of your assets, you can check the box below to use the primary default.', 'name' => 'Category Name', From f0a6a0026ae1e0dae255fdea339419a84f2951d1 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 13:03:37 -0700 Subject: [PATCH 09/10] Improve phrasing --- resources/lang/en-US/admin/categories/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/lang/en-US/admin/categories/general.php b/resources/lang/en-US/admin/categories/general.php index 838b4abb66..ac90a98939 100644 --- a/resources/lang/en-US/admin/categories/general.php +++ b/resources/lang/en-US/admin/categories/general.php @@ -3,7 +3,7 @@ return array( 'asset_categories' => 'Asset Categories', 'category_name' => 'Category Name', - 'email_to_user_upon_checkin' => 'Send email to user on checkin.', + 'email_to_user_upon_checkin' => 'Send email to user upon checkin.', 'email_to_user_upon_checkin_and_checkout' => 'Send email to user upon checkin/checkout.', 'email_to_initiator' => 'Send email to you when user accepts or declines checkout.', 'checkin_email_notification' => 'This user will be sent an email on checkin/checkout.', From 894606b62ec80082d271f3cfbfb129955ca4e7a6 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Wed, 29 Oct 2025 13:16:03 -0700 Subject: [PATCH 10/10] Remove old tests --- .../Feature/Livewire/CategoryEditFormTest.php | 81 ------------------- 1 file changed, 81 deletions(-) diff --git a/tests/Feature/Livewire/CategoryEditFormTest.php b/tests/Feature/Livewire/CategoryEditFormTest.php index 4596af120a..1bc0448917 100644 --- a/tests/Feature/Livewire/CategoryEditFormTest.php +++ b/tests/Feature/Livewire/CategoryEditFormTest.php @@ -16,87 +16,6 @@ class CategoryEditFormTest extends TestCase ])->assertStatus(200); } - public function testSendEmailCheckboxIsCheckedOnLoadWhenSendEmailIsExistingSetting() - { - Livewire::test(CategoryEditForm::class, [ - 'sendCheckInEmail' => true, - 'eulaText' => '', - 'useDefaultEula' => false, - ])->assertSet('sendCheckInEmail', true); - } - - public function testSendEmailCheckboxIsCheckedOnLoadWhenCategoryEulaSet() - { - Livewire::test(CategoryEditForm::class, [ - 'sendCheckInEmail' => false, - 'eulaText' => 'Some Content', - 'useDefaultEula' => false, - ])->assertSet('sendCheckInEmail', true); - } - - public function testSendEmailCheckboxIsCheckedOnLoadWhenUsingDefaultEula() - { - Livewire::test(CategoryEditForm::class, [ - 'sendCheckInEmail' => false, - 'eulaText' => '', - 'useDefaultEula' => true, - ])->assertSet('sendCheckInEmail', true); - } - - public function testSendEmailCheckBoxIsUncheckedOnLoadWhenSendEmailIsFalseNoCategoryEulaSetAndNotUsingDefaultEula() - { - Livewire::test(CategoryEditForm::class, [ - 'sendCheckInEmail' => false, - 'eulaText' => '', - 'useDefaultEula' => false, - ])->assertSet('sendCheckInEmail', false); - } - - public function testSendEmailCheckboxIsCheckedWhenCategoryEulaEntered() - { - Livewire::test(CategoryEditForm::class, [ - 'sendCheckInEmail' => false, - 'useDefaultEula' => false, - ])->assertSet('sendCheckInEmail', false) - ->set('eulaText', 'Some Content') - ->assertSet('sendCheckInEmail', true); - } - - public function testSendEmailCheckboxCheckedAndDisabledAndEulaTextDisabledWhenUseDefaultEulaSelected() - { - Livewire::test(CategoryEditForm::class, [ - 'sendCheckInEmail' => false, - 'useDefaultEula' => false, - ])->assertSet('sendCheckInEmail', false) - ->set('useDefaultEula', true) - ->assertSet('sendCheckInEmail', true) - ->assertSet('eulaTextDisabled', true) - ->assertSet('sendCheckInEmailDisabled', true); - } - - public function testSendEmailCheckboxEnabledAndSetToOriginalValueWhenNoCategoryEulaAndNotUsingGlobalEula() - { - Livewire::test(CategoryEditForm::class, [ - 'eulaText' => 'Some Content', - 'sendCheckInEmail' => false, - 'useDefaultEula' => true, - ]) - ->set('useDefaultEula', false) - ->set('eulaText', '') - ->assertSet('sendCheckInEmail', false) - ->assertSet('sendCheckInEmailDisabled', false); - - Livewire::test(CategoryEditForm::class, [ - 'eulaText' => 'Some Content', - 'sendCheckInEmail' => true, - 'useDefaultEula' => true, - ]) - ->set('useDefaultEula', false) - ->set('eulaText', '') - ->assertSet('sendCheckInEmail', true) - ->assertSet('sendCheckInEmailDisabled', false); - } - public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula() { Livewire::test(CategoryEditForm::class, [