Merge pull request #17296 from uberbrady/improve_fmcs_locations_test

Fixed #17190 and [FD-49375]: Do FMCS testing 'async' to keep from blowing out the whole settings page
This commit is contained in:
snipe
2025-06-25 13:10:54 +01:00
committed by GitHub
3 changed files with 10 additions and 4 deletions

View File

@@ -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()

View File

@@ -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',

View File

@@ -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>