Skip to content

A free open source IT asset/license management system

Do the FMCS testing 'async' to keep from blowing out the whole page

Brady Wetherington6e2d7912b581
diff --git a/app/Livewire/LocationScopeCheck.php b/app/Livewire/LocationScopeCheck.php
index e176d41f0a..24beb9413f 100644
--- a/app/Livewire/LocationScopeCheck.php
+++ b/app/Livewire/LocationScopeCheck.php
@@ -10,15 +10,16 @@ class LocationScopeCheck extends Component
{
public $mismatched = [];
public $setting;
+ public $is_tested = false;
public function check_locations()
{
$this->mismatched = Helper::test_locations_fmcs(false);
+ $this->is_tested = true;
}
public function mount() {
$this->setting = Setting::getSettings();
- $this->mismatched = Helper::test_locations_fmcs(false);
}
public function render()
diff --git a/resources/lang/en-US/admin/settings/general.php b/resources/lang/en-US/admin/settings/general.php
index 149667a5ce..fdbb0d8c52 100644
--- a/resources/lang/en-US/admin/settings/general.php
+++ b/resources/lang/en-US/admin/settings/general.php
@@ -157,6 +157,7 @@ return [
'scope_locations_fmcs_support_text' => 'Scope Locations with Full Multiple Companies Support',
'scope_locations_fmcs_support_help_text' => 'Restrict locations to their selected company.',
'scope_locations_fmcs_check_button' => 'Check Compatibility',
+ 'scope_locations_fmcs_test_needed' => 'Please Check Compatibility to enable this',
'scope_locations_fmcs_support_disabled_text' => 'This option is disabled because you have conflicting locations set for :count or more items.',
'show_in_model_list' => 'Show in Model Dropdowns',
'optional' => 'optional',
diff --git a/resources/views/livewire/location-scope-check.blade.php b/resources/views/livewire/location-scope-check.blade.php
index 8feb8ea25f..c26f8bcf17 100644
--- a/resources/views/livewire/location-scope-check.blade.php
+++ b/resources/views/livewire/location-scope-check.blade.php
@@ -1,11 +1,15 @@
<div>
- <label class="form-control{{ (count($mismatched) > 0) ? ' form-control--disabled' : '' }}">
- <input type="checkbox" name="scope_locations_fmcs" value="1" @checked(old('scope_locations_fmcs', $setting->scope_locations_fmcs)) aria-label="scope_locations_fmcs" {{ (count($mismatched) > 0) ? ' disabled' : '' }}/>
+ <label class="form-control{{ (!$is_tested || count($mismatched) > 0 ) ? ' form-control--disabled' : '' }}">
+ <input type="checkbox" name="scope_locations_fmcs" value="1"
+ @checked(old('scope_locations_fmcs', $setting->scope_locations_fmcs)) aria-label="scope_locations_fmcs" {{ (!$is_tested || count($mismatched) > 0) ? ' disabled' : '' }}/>
{{ trans('admin/settings/general.scope_locations_fmcs_support_text') }}
</label>
<p class="help-block">
{{ trans('admin/settings/general.scope_locations_fmcs_support_help_text') }}
- <strong>{{ (count($mismatched) > 0) ? trans('admin/settings/general.scope_locations_fmcs_support_disabled_text', ['count' => count($mismatched)]) : '' }}</strong>
+ <strong>{{ ($is_tested && count($mismatched) > 0) ? trans('admin/settings/general.scope_locations_fmcs_support_disabled_text', ['count' => count($mismatched)]) : '' }}</strong>
+ @if(!$is_tested)
+ <strong>{{ trans('admin/settings/general.scope_locations_fmcs_test_needed') }}</strong>
+ @endif
</p>
<button class="btn btn-sm btn-default" wire:click.prevent="check_locations">{{ trans('admin/settings/general.scope_locations_fmcs_check_button') }}</button>
</div>
\ No newline at end of file